vs72737 / xdocreport

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

Some mergefields in .docx XML are randomly divided into several runs. Please add a support of these cases #483

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a lot of several mergefields in .docx document (e.g. 
@before-cell#if($p.source) and @after-cell#end in a table cell).
In my case the larger is the document the more is a probability that some of 
the mergefields will be divided into different runs in document.xml as it is 
shown on the attached screenshot.
2. Try to fill this template using java.

What is the expected output? What do you see instead?
I expect that every mergefield will be filled but in practice the other 
situation happens - those mergefields that were divided into various runs will 
not be filled. If you try to launch your java code once again you will discover 
that the same mergefields were not filled because they are stored in the 
template itself.

What version of the product are you using? On what operating system?
- xDocReport 1.0.6, but I tried to use earlier versions too - it does't matter.
- MS Word 2010 for creating templates - the problem is in it but I would like 
to ask you to create more smart solution that will take this stupid fault into 
consideration 
- OS Windows 8.1

Please provide any additional information below.
The most interesting thing is that if you try to delete and re-enter bad 
mergefields with the same information there will be a probability they will not 
be spoiled again.

I understand it is not a problem of yours and your library. Moreover it's 
really easy to use and it's a pleasure to work with it, but this trouble is a 
real headache for me and doesn't allow to work normally. Please add some 
features so that this problem will not be a problem anymore.

Thank you very much!
Nick.

Original issue reported on code.google.com by NICKy103...@gmail.com on 9 Jun 2015 at 3:35

Attachments:

GoogleCodeExporter commented 8 years ago
At first please create your issue at 
https://github.com/opensagres/xdocreport/issues

The split of mergefields is done by preprocessing. It seems that you have a 
case which is not supported?

It should be very cool if you could create a test with your case like 
https://github.com/opensagres/xdocreport/blob/master/integrationtests/fr.opensag
res.xdocreport.core.test/src/test/java/fr/opensagres/xdocreport/document/docx/pr
eprocessor/DocxPreprocessorWith2InstrText.java

Original comment by angelo.z...@gmail.com on 9 Jun 2015 at 4:02

GoogleCodeExporter commented 8 years ago
Hi Angelo,
Thank you for answer, I really appreciate your rapidness.

First of all, I've created this issue on GitHub.
https://github.com/opensagres/xdocreport/issues/37

Then, I'm attaching an example to this message, there ".. you can find a 
template, scala/java code and resulting output. I need to implement my project 
in scala so this template was processed using scala code too. But for your 
convenience I've added equivalent java code"

I've been tried to find a bit more information what exactly is wrong and I've 
found that as it's shown at screenshots every run has its own RSID parameter. 
It serves for conveniet merging of documents and can be turned off. It could be 
helpful, but..
- In the attached template "@before-cell#if($print.variableThree)" mergefield 
was broken even without any RSIDs and wasn't filled correctly.
- In my project (sorry, I can't attach it) it seems that turnind RSIDs off 
helped and fresh mergefields (I tested ones with "@before-cell" token - it is 
the main headache) were really created as a single run. Whatever after 
processing resulting table didn't contain some cells/rows/columns (I can't 
guess a rule in which they are being deleted) as before.

Then I've tried to edit document.xml myself to make broken mergefields look 
like ordinary ones. It didn't affect on template's view but my program began 
throwing strange parse exceptions even if I've only removed really unnecessary 
runs.

So I'm in panic a bit, please do something :(

Thank you!

P.S. I apologize for grammatical mistakes if you've found any

Original comment by NICKy103...@gmail.com on 10 Jun 2015 at 10:41

Attachments: