Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Import non-redoc docx files. #10

Open
noamross opened this issue Dec 2, 2018 · 2 comments
Open

Import non-redoc docx files. #10

noamross opened this issue Dec 2, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@noamross
Copy link
Owner

noamross commented Dec 2, 2018

A convenience wrapper for converting non-redoc files will probably be useful. It can go beyond pandoc_convert() and do some things like setting up the YAML headers.

One possibility is that undoc() does this anyway with a warning/message.

@statnmap
Copy link

statnmap commented Jul 1, 2019

Thank you for your package.
In case some person would like to import non-redoc docx files, they can cheat:

# In your R editor
# Create an empty Rmd
# add `output: redoc::redoc` in the YAML
# Save the Rmd : "my-document.Rmd"
# Render it in docx
rmarkdown::render("my-document.Rmd", output_format = redoc::redoc())

# Open the created docx with your doc editor
# Copy-paste the original.docx you wanted
# Close the editor

# > If you had images included
# Create a copy of your "original.docx"
# Change the extension as "original.zip"
# Unzip the file with your prefered unzipper
# Extract the "media" folder in the same directory as your "my-document.Rmd"

# Go back to your R editor and dedoc the file
redoc::dedoc(docx = "my-document.docx", overwrite = TRUE)
# redoc::dedoc_to_new_file(docx = "my-document.docx")

This is not perfect procedure, but it's a start.

@statnmap
Copy link

statnmap commented Jul 1, 2019

However, if you remove an image, because Word rename them image1.png, image2.png, ... Wrong images are used.
I tried to rename them prior to render, but the name of my image is not accounted for when I dedoc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants