MohamedSaeed / xdocreport

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

Font formatting not retained when used with SyntaxKind.Html in docx #416

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a docx template with a mergefield and format the mergefield with a 
font other then Times New Roman (let's say Arial, 18px, lightgrey)
2. Add a portion of HTML (no css styles applied, nor tags like <b>, <i>) to the 
model and set SyntaxKind.Html to that particular field.
3. Process the template and the model with Freemarker

Expected output: Replaced mergefield retains the font size and family (Arial 
18px). 
Actual output: Replaced mergefield is formatted with default font (Times New 
Roman 12px, black)

What version of the product are you using? On what operating system?
Linux / Oracle JVM 7/8 / XDocReport 1.0.4

I figured this works with ODT files. When the HTML is not wrapped in a <p> tag, 
the format will remain as it has been applied to the mergefield. When content's 
wrapped in <p> tag, the behaviour is the same as described with docx.
Unfortunately I'm not able to provide a example docx file, since Word is not 
running on linux, but it's pretty basic.

Original issue reported on code.google.com by m.fischb...@gmail.com on 6 Jul 2014 at 5:58

GoogleCodeExporter commented 9 years ago
I know this problem, but I I'm afraid it's a very hard task : I think we need 
extract font size, name, etc from docx and put it to velocity context to 
generate the well font info. Perhap's there is a better mean, but no time for 
th emoment to study that.

Any contribution are welcome!

Original comment by angelo.z...@gmail.com on 6 Jul 2014 at 1:59