Open GoogleCodeExporter opened 9 years ago
Merge 2 docx is an hard task, so it's out of the scope of XDocReport.
As you has said, you must use a start/end loop to manage that. I have an idea
to manage this start/end loop with lazily with preprocessor (no need to set the
start/end loop in the docx, and more you could use the same docx template for a
loop of person or just one person).
Original comment by angelo.z...@gmail.com
on 26 Nov 2013 at 11:36
I'm not sure what exactly you mean but seem good. I look forward to it.
One of problem with loop is readability - adding page break per person means
end loop is in the next page.
Thanks for prompt response.
Original comment by dennisl...@gmail.com
on 26 Nov 2013 at 11:45
> One of problem with loop is readability - adding page break per person means
end loop is in the next page.
I agree with you, that's why my idea is to generate the start/end loop
directive with preprocessor.
Here some explanation about my idea : imagine you wish to generate a report
with a list of developers and use the same report to generate one developer.
1) you create your docx like this :
${developer.name}
2) If you wish to generate a report with just a developer, you do like this :
------------------------------------------
Developer developer = ....
IContext context = ....
content.put("developer", developer);
------------------------------------------
3) now if you wish to generate a list of developers, you will do like this :
------------------------------------------
FieldsMetata metadata = ...
metadata.setGlobalLoop("developers","developer");
List<Developer> developers = ....
IContext context = ....
content.put("developers", developers);
------------------------------------------
the use of setGlobalLoop, will add automaticly :
1) [#list developers as developer] on start of the docx.
2) [/#list] on end of the docx.
Original comment by angelo.z...@gmail.com
on 27 Nov 2013 at 12:07
Seems good to me. Look forward to it. Thanks.
Original comment by dennisl...@gmail.com
on 27 Nov 2013 at 12:18
Another vote for me.
We have exactly the same requirement: create a letter from the same template to
multiple people.
I already solved this, but it's much uglier than the suggestion. I am also
using #foreach($contact in $contacts) and I had to replace each tag e.g.
$salutation with $contact.salutation.
I also have to manage pagebreaks in between persons but not for the last
person. Somehow I managed to solve this but had had to create a tag
$contact.pagebreak that is filled with
"<p style=\"page-break-after:always\"></p>"
Original comment by Henno.Ve...@gmail.com
on 27 Jan 2014 at 1:53
If I understand your need :
1) you wish to avoid writing "#foreach($contact in $contacts)" in the docx.
2) you wish to write "$salutation" instead of writing "$contact.salutation" in
the docx.
3) you wish to avoid using $contact.pagebreak to manage page break.
If it that, I think it's possible to do it with XDocReport by improving
preprocessor like I have explained.
Original comment by angelo.z...@gmail.com
on 27 Jan 2014 at 2:00
<angelo.z...@gmail.com>
Now that I read your post again, it seems what you explained is already
possible. Right? If so, can you explain more about it please? I can't
understand how I can do this.
FieldsMetata metadata = ...
metadata.setGlobalLoop("developers","developer");
Original comment by dennisl...@gmail.com
on 29 May 2014 at 3:07
Today it's not possible. I had no time to implement this feature.
Original comment by angelo.z...@gmail.com
on 29 May 2014 at 9:58
Sorry. I wasn't sure it is to implement or already in there. Hope it can be
added soon. Thanks.
Original comment by dennisl...@gmail.com
on 29 May 2014 at 1:20
Original issue reported on code.google.com by
dennisl...@gmail.com
on 26 Nov 2013 at 11:28