Page 1 of 1

Word template problem.

PostPosted: Sat Oct 09, 2010 10:29 am
by ThanksDocx4j
Hi,

I am using docx4j to generate letters based on template using codes from the UnmarshallFromTemplate.java sample. It works great!!!

However I met a problem with word. For example, I typed the following into Word: Dear ${firstName}, after saving it, Word generate the following XML:
<w:t>${</w:t></w:r><w:proofErr w:type="spellStart"/><w:r w:rsidR="00F35EC5"><w:t>firstName</w:t></w:r><w:proofErr w:type="spellEnd"/><w:r w:rsidR="00F35EC5"><w:t>}</w:t></w:r><w:r><w:t>,
You can see the "${" and "firstName" and "}" are separated, just wondering is there any way to avoid this in Word?

Thanks a lot!

Re: Word template problem.

PostPosted: Sun Oct 10, 2010 8:42 pm
by ThanksDocx4j
Solved. Just use regular expression to remove the XML tags.

Re: Word template problem.

PostPosted: Mon Oct 11, 2010 7:24 pm
by jason
Or you can turn off spelling and grammar checking in Word.

Word Options > Proofing .. Hide spelling errors; Hide grammar options.

Also, are you aware you could use custom xml data binding as an alternative approach?

cheers .. Jason