Shrimp007 / xdocreport

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

You can not use generated docx files containing multiline fields as template #401

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. you create a document containing a variable (see attachment : input.docx)
2. you assign a multiline String to the variable 
3. you merge the document and the variable (see attachment : output.docx)
4. you merge the document a second time but pass no variables (see attachment : 
final_output.docx)

I added a program in attachment that shows the problem : compare the 2 output 
docs to see the difference.

What is the expected output? What do you see instead?
You expect "output.docx" and  "final_output.docx" to be identical, but they 
aren't.  Only the last line of the multiline remains.

What version of the product are you using? On what operating system?
version 1.0.4

Please provide any additional information below.
We ran into this problem because we use xdocreports in two steps.  In the first 
step we generate a number of documents with different headers and footers.
Then we use them to give the documents a different "body".

Original issue reported on code.google.com by mario.cl...@gmail.com on 13 May 2014 at 2:01

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Mario,

Thank a lot for your explanation and attached docx. It seems that it's a 
problem with preprocessing. But today I have no time to study it.

I will see this problem when I will have time.

Regards Angelo

Original comment by angelo.z...@gmail.com on 13 May 2014 at 2:18

GoogleCodeExporter commented 9 years ago
hello Angelo,

this issue is really causing us a lot of trouble.  I have been trying to fix it 
myself, but haven't succeeded so far yet, unfortunately.
I think it is linked to the fact that a <w:r> is supposed to have only one 
<w:t> : RBufferedRegion.setTcontent(String c).
In the class MergefieldBufferedRegion I tried changing getTRegion as follows, 
but it doesn't seem to work :
public BufferedElement getTRegion()
    {
        if ( tRegion == null )
        {
//            tRegion = super.findFirstChild( "w:t" );
            tRegion = getParent().findLastChild("w:t");
        }
        return tRegion;
    }

Do you have any idea when you might find the time to have a deeper look at this 
problem ?  It would help us a lot.

Thanks in advance,

Mario

Original comment by mario.cl...@gmail.com on 7 Aug 2014 at 9:19

GoogleCodeExporter commented 9 years ago
Hi mario,

It's very hard for me to find time for XDocReport because I'm very busy with 
oen other open source project which works well (a lot of issues).

I have created a JUnit with your case at 
https://code.google.com/p/xdocreport/source/browse/integrationtests/fr.opensagre
s.xdocreport.core.test/src/test/java/fr/opensagres/xdocreport/document/docx/prep
rocessor/Issue401.java

It's not activated (uncomment @Test). If I find time, I will fix it.

Original comment by angelo.z...@gmail.com on 7 Aug 2014 at 10:04

GoogleCodeExporter commented 9 years ago
Ok I have commited a fix 
https://code.google.com/p/xdocreport/source/detail?r=97b41c46da031f83e2213965a29
179f8c25bd0d4

Please try it and tell me if it works for you.

Regard's Angelo

Original comment by angelo.z...@gmail.com on 7 Aug 2014 at 11:37

GoogleCodeExporter commented 9 years ago
It seems to work perfectly.
Thanks a million. You're the best !

Mario

2014-08-07 13:37 GMT+02:00 <xdocreport@googlecode.com>:

Original comment by mario.cl...@gmail.com on 7 Aug 2014 at 5:07

GoogleCodeExporter commented 9 years ago
> It seems to work perfectly.

Cool!

>Thanks a million. You're the best !

Thank's!

Next time, if you some problem with preprocessing, please create a simple JUnit 
test like I have done. It's boring to do that but it will help me a lot because 
of my available little time.

Regard's Angelo

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