opensagres / xdocreport

XDocReport means XML Document reporting. It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).
https://github.com/opensagres/xdocreport
1.22k stars 371 forks source link

Html fields could not be outside a paragraph #93

Open kevinsdooapp opened 8 years ago

kevinsdooapp commented 8 years ago

During resolution of issue 89. I noticed that the transformed html field is put into a velocity variable $___NoEscape0. This variable is placed into the parent W:P word field. So it's required to place the html field to a new paragraph.

I'm wrote a test case in my pull request for the issue 89. (issue93 test). I tryied to fix it withour success. I hope that you could fix it. See MergefieldBufferedRegion Line 187.

 if ( fieldAsTextStyling != null )
 {
       // Find parent paragraph
       BufferedElement parent = mergefield.findParent( W_P ); // should be W_R no???

TEST CASE html_loop_with_paragraphs.docx html_loop_without_paragraph.docx

kevinsdooapp commented 8 years ago

Hi, Did you have a look at this issue? Thank you in advance

angelozerr commented 8 years ago

It seems that it's a complex case, I will study it when I will find time.

kevinsdooapp commented 8 years ago

Ok, anyway can you have a look at the pull request #89 (Html inside loop breaks template).

Thank you

angelozerr commented 8 years ago

I have seen quicly your PR. Problem is that it works only with Velocity and not with Freemarker. And I don't understand very well the test https://github.com/opensagres/xdocreport/pull/92/files#diff-4ffa52ba5ffcadb0764feda1a4bfa0afR127

I must find time to fix that

kevinsdooapp commented 8 years ago

As I explain in issue #89 :

The problem was registered html fields were transformed even on instruction fields (for/if). I fixed it and did a pull request.

ie: #foreach($html in ...) -> if html field is marked as HTML kind in the context, the $html field will be replaced by something like $___NoEscape0[...], even in instruction (for/if) fields which break the them at velocity time.

The fix was to exclude html interpolation in instruction fields (for/if/set).

kevinsdooapp commented 8 years ago

Hi @angelozerr,

Is there a release planned soon?

angelozerr commented 8 years ago

Is there a release planned soon?

when @pascalleclercq will have time to do that.

kevinsdooapp commented 8 years ago

Hi Angelo, Do you have some news? If you don't have time to solve the problem for Freemarker, can you at least accept the pull request that fix the case for Velocity? We are still waiting for a release that include this fix. It's always a shame to release ignoring snapshots dependencies. Thank you in advance for your understanding Kevin

angelozerr commented 8 years ago

@kevinsdooapp I'm really sorry, I'm very busy and I have no time to study your issue. I don't want to accept a PR that I don't have studied a lot. Hope you will understand.