karurkarthi / xdocreport

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

Suggestion: Remove unhandled fields after mail merge #331

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Document contains a MergeField named $unused
2. Create a report from this document but do not provide a value for the key 
"unused"
3. The resulting PDF contains the text "$unused"

What is the expected output? What do you see instead?
It would be fine to "clean" a document after the mail merge operation and 
replace all unhandled fields by the empty string.
Maybe this should be an option for the report generator. While designing a 
document it may be helpful to visualize forgotten fields.

Original issue reported on code.google.com by jarland...@googlemail.com on 20 Nov 2013 at 3:52

GoogleCodeExporter commented 9 years ago
I suppose you use Velocity, and according the doc you can write $!unused to 
manage your case. Perhaps there is a Velocity config for that too write $unused 
and replaced it with blank, Never tested that.

Original comment by angelo.z...@gmail.com on 20 Nov 2013 at 11:26

GoogleCodeExporter commented 9 years ago
Ok, thank you!

Our templates will be maintained by the domain experts, so the template 
language should be as simple as possible. The "!"-notation helps, but I fear it 
will be mostly forgotten in reality.

Velocity do not have a config to make this silent notation the default. 
However, there is a way utilizing EbentHandler to find missing values at 
runtime, see:
http://www.apprigger.com/2012/03/apache-velocity-default-silent-mode/
This has to be implemented by XDocReport, controlled by Options.subOptions. 

Maybe we will provide a Map implementation to the report generator which 
provides empty strings for missing keys.

Original comment by jarland...@googlemail.com on 21 Nov 2013 at 9:21

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/xdocreport/issues/detail?id=258#c7 could interest you.

Original comment by angelo.z...@gmail.com on 21 Nov 2013 at 9:45

GoogleCodeExporter commented 9 years ago
Yes, that solved my suggestion. Works like a charm!

Original comment by jarland...@googlemail.com on 21 Nov 2013 at 2:32

GoogleCodeExporter commented 9 years ago

Original comment by angelo.z...@gmail.com on 5 Jan 2014 at 4:11

GoogleCodeExporter commented 9 years ago
cleanup

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