MohamedSaeed / xdocreport

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

Formatting switch to a field code within Docx not interpreted #440

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. freemarker template docx containing MergeField with formatting switch added 
to "Field Codes":

{ MERGEFIELD  ${project.balance} \# $#,###.00 }

2. Model object Project with:   public Double balance;

What is the expected output? What do you see instead?

expected: $1,333.88
instead: 1 333,881 \# $#,###.00

What version of the product are you using? On what operating system?
1.0.4 - Word 2010 - Windows 7/Linux

Please provide any additional information below.

We want use xdocreport with converting to pdf on server.

We should change format of numbers for different languages without change of 
source data.

Description of insert and format field codes in Word 2010 -  
http://office.microsoft.com/en-001/word-help/insert-and-format-field-codes-in-wo
rd-2010-HA101830917.aspx?CTT=1

Is there something I am missing or a workaround?

Regards

Simeon Zhmakin

Original issue reported on code.google.com by SZhma...@gmail.com on 3 Sep 2014 at 4:04

GoogleCodeExporter commented 9 years ago
Hi Simeon,

You cannot use MS Word MERGEFIELD format to format number, because XDocReport 
doesn't evaluate mergefield. It uses mergefield to set Freemarker syntax 
without splitting in several XML elements (if you write Freemarker code inside 
your docx, without mergefield, your Freemarker code is plitted in several XML 
elements).

If you want to format your field, you must use Freemarker format number 
http://freemarker.org/docs/ref_builtins_number.html

Regard's Angelo

Original comment by angelo.z...@gmail.com on 3 Sep 2014 at 7:42

GoogleCodeExporter commented 9 years ago
cleanup

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