Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use existing docx file / template #17

Open
Judochopalots opened this issue Aug 13, 2024 · 1 comment
Open

Use existing docx file / template #17

Judochopalots opened this issue Aug 13, 2024 · 1 comment

Comments

@Judochopalots
Copy link

It would be great if WriteDocx could also write directly into an existing docx / dotx file. This helps with styling by using the styles existing in the template file.

R (bookdown) does it this way which I think makes the most sense with minimal effort. Matlab uses developer components in the docx file to search for a tag, where it starts writing sections to, but this has some drawbacks.

@jkrumbiegel
Copy link
Collaborator

What I don't want to do is implement roundtrip capability docx => Julia => docx because there are so many possible tags that it would take forever to implement all of them and test them. What we can already do is unzip a docx file, access the main xml file and open it with EzXML, then we can link xml generated with WriteDocx.jl into that and write it back out.

This worked already for simple things like tables when I tried it. It's more difficult when you start using objects that need rels, like images, because then you need to modify those rel files in accordance with your content. So this is somewhat more work to do well.

Another avenue if you want styles is to read only the styles from a given docx file and apply those when rendering a full WriteDocx file. This would be much less work than having to represent a full docx file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants