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

is it possible to use @RawXML and keep formatting\font of template docx? #320

Closed
mvlare opened this issue Jun 15, 2017 · 1 comment
Closed
Labels

Comments

@mvlare
Copy link

mvlare commented Jun 15, 2017

I am using @rawxml to put in linebreaks into the variables, as described in: http://docxtemplater.readthedocs.io/en/latest/faq.html#how-to-insert-linebreaks

However formatting\fonts (like big bold font) gets lost\not used of the @variable in the template after rendering. Is there a way to solve this?

Perhaps this question is the same as issue #159 But ok, would still like to be sure it is not possible\too tedious and not in scope to be developed with docxtemplater.

@edi9999
Copy link
Member

edi9999 commented Jun 20, 2017

No that it not possible with docxtemplater : the raw xml tag will completely remove the tag <w:p><w:r></w:r></w:p>, and this tag contains the style of the document.

One possible solution would be to use the HTML Module : https://modules.docxtemplater.com/modules/html/

This module handles to "keep the existing style" since version 3.0.4, and handles
tag for newline (and lots of other tags)

3.0.4

Keep word-run style for inline replacement. For example if, the text that the {~html} tag is written in is red, it will also be the base style for the generated elements of the html tag.

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

No branches or pull requests

2 participants