MohamedSaeed / xdocreport

Automatically exported from code.google.com/p/xdocreport
1 stars 0 forks source link

Is it possible to use different fonts in fields? #384

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello.
I use XDocreport to create docx documents from templates with Freemarker 
variable fields. I wish some my fields had different font styles. For example, 
I’d like the template text 
“$name” to be replaced  with “Alex” with «Arial» font and «$age» to 
be replaced to “33” with “Magnetto” font. But I can’t find any way  
to do this. I’ve found an example which use DOMFontsPreprocessor

report.addPreprocessor( DocxConstants.WORD_DOCUMENT_XML_ENTRY, 
DOMFontsPreprocessor.INSTANCE );
report.addPreprocessor( 
context.put(DOMFontsPreprocessor.FONT_NAME_KEY, "Magneto");

But in this case we change all text to Magneto font, and I want to change just 
some fields to different fonts. 
What can I do?
Thanks in advance!

Original issue reported on code.google.com by StalAlex...@gmail.com on 14 Mar 2014 at 12:27

GoogleCodeExporter commented 9 years ago
Hi,

To do that you have 2 solutions : 

1) manage font in the docx template by using MS Word (you set the font to teh 
mergefield).
2) improve DOMFontsPreprocessor to change font only for some fields.

Regards Angelo

Original comment by angelo.z...@gmail.com on 14 Mar 2014 at 1:26

GoogleCodeExporter commented 9 years ago

Original comment by angelo.z...@gmail.com on 7 Aug 2014 at 8:57

GoogleCodeExporter commented 9 years ago
cleanup

Original comment by pascal.leclercq on 10 Oct 2014 at 7:37