vs72737 / xdocreport

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

Error on null or empty HLink #403

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a template with a HyperLink, displayed only if URL is not null and 
not empty (HyperLink hidden with a "if" statement).
2. Insert an empty or a null URL in the context.
3. Launch the document processing.

What is the expected output? What do you see instead?
A document without HyperLink.
Instead the following error appears in the logs and the document isn't built at 
all : 

The following has evaluated to null or missing:
==> ___HyperlinkRegistryword_document_xml.hyperlinks  [in template 
"word/_rels/document.xml.rels" at line 1, column 1257]

Tip: If the failing expression is known to be legally null/missing, either 
specify a default value with myOptionalVar!myDefault, or use [#if 
myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the 
last step of the expression; to cover the whole expression, use parenthessis: 
(myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction (FTL stack trace):
----------
==> #list ___HyperlinkRegistryword_docume...  [in template 
"word/_rels/document.xml.rels" at line 1, column 1250]
----------

What version of the product are you using? On what operating system?
XDoxReport 1.0.4 on Ubuntu Precise 12.04.4 LTS 

Please provide any additional information below.
The enclosed test case shows how XDocReport reacts when a HLink is inserted in 
the Template and hidden if the URL is empty or null.

I'm using the Freemarker Bracket syntax to built a .docx document.
In my case, I need to display a label with a HyperLink, only if the URL isn't 
null nor empty. I'm hidding my HLink using [#if]...[/#if] in my template.

HyperlinkRegistry.hyperlinks seems to be null until 
HyperlinkRegistry.registerHyperlink() is called, which is not the case when 
there is no visible HyperLink in the document.

Original issue reported on code.google.com by j.gonzalez.saetero@gmail.com on 2 Jun 2014 at 12:59

Attachments:

GoogleCodeExporter commented 8 years ago
Thank's for your attached zip.

I will see this problem when I will have time. Any contribution are welcome!

Regards Angelo

Original comment by angelo.z...@gmail.com on 2 Jun 2014 at 1:05

GoogleCodeExporter commented 8 years ago
Your problem comes from with your Hyperlink which is embedded inside a 
mergefield. XDocReport doesn't manage this case. Your link appears with quote : 

-----------------------------
«${url}»
-----------------------------

To resolve your problem, remove teh content of your hyperlink by paying 
attention to remove to teh quotes « »

Recreate your hyperlink,  by checking you have not quotes : 

-----------------------------
${url}
-----------------------------

Original comment by angelo.z...@gmail.com on 7 Aug 2014 at 4:49