Issue 97 in xdocreport: Inline loop with @before-row

408 views
Skip to first unread message

xdocr...@googlecode.com

unread,
Apr 3, 2012, 5:46:00 AM4/3/12
to xdocr...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 97 by roman.de...@gmail.com: Inline loop with @before-row
http://code.google.com/p/xdocreport/issues/detail?id=97

Hello!

There are no possibility to use inline loops with directive @before-row. I
expect that the code:

<table>
<row>
<cell>
@before-row#foreach($d in $developers)
@before-row#foreach($r in $d.roles)
$d.name : $r.name
@after-row#end
@after-row#end
</cell>
.
.
.
</row>
</table>

will be transformed to following(prepared for template engine):

<table>
@before-row#foreach($d in $developers)
@before-row#foreach($r in $d.roles)
<row>
<cell>
$d.name : $r.name
</cell>
.
.
.
</row>
@after-row#end
@after-row#end
</table>

In TransformedBufferedDocumentContentHandler I found that inner loop
overrides the outer one:

elementInfo.setContentBeforeStartTagElement(before);

instead of it You can use code like:

String fullBefore = elementInfo.getContentBeforeStartTagElement();
if (StringUtils.isEmpty(fullBefore)) {
fullBefore = "";
}
fullBefore = fullBefore + " " + before;
elementInfo.setContentBeforeStartTagElement(fullBefore);

I tried to use my own version of DocXBufferedDocumentContentHandler
(through the extension of DocxPreprocessor) with overrided methods
processScriptAfter... But this way is a bit ugly(alsо I need to rewrite
method getIndexOfScript that is private)....

Adding support for nested loops are easier
TransformedBufferedDocumentContentHandler.

xdocr...@googlecode.com

unread,
Apr 3, 2012, 5:52:03 AM4/3/12
to xdocr...@googlegroups.com
Updates:
Status: Accepted

Comment #1 on issue 97 by angelo.z...@gmail.com: Inline loop with
@before-row
http://code.google.com/p/xdocreport/issues/detail?id=97

Hi,

Could you explain what you wish to generate and if you explain me your code
changes, I could perhaps integrate it?

Regards Angelo

xdocr...@googlecode.com

unread,
Apr 3, 2012, 7:26:42 AM4/3/12
to xdocr...@googlegroups.com

Comment #2 on issue 97 by roman.de...@gmail.com: Inline loop with
@before-row
http://code.google.com/p/xdocreport/issues/detail?id=97

Yes.
Changes in TransformedBufferedDocumentContentHandler (v0.9.6).

elementInfo.setContentBeforeStartTagElement( before );
to:
String existedBefore = elementInfo.getStartTagElement().getBefore();

elementInfo.setContentBeforeStartTagElement((StringUtils.isEmpty(existedBefore) ? "" :
existedBefore) + " " + before);

elementInfo.setContentAfterEndTagElement( after );
to:
String existedAfter = elementInfo.getEndTagElement().getAfter();
elementInfo.setContentAfterEndTagElement(after + " " +
(StringUtils.isEmpty(existedAfter) ? "" : existedAfter));


Template(it works after changes) and expected result are in attachment.

Attachments:
template.docx 13.7 KB
expected_result.docx 13.4 KB
TransformedBufferedDocumentContentHandler.java 14.9 KB

xdocr...@googlecode.com

unread,
Apr 3, 2012, 10:54:33 AM4/3/12
to xdocr...@googlegroups.com

Comment #3 on issue 97 by angelo.z...@gmail.com: Inline loop with
@before-row
http://code.google.com/p/xdocreport/issues/detail?id=97

Hi Roman,

Ok I understand the problem. I will fix that as soon as possible.

Regards Angelo

xdocr...@googlecode.com

unread,
Apr 4, 2012, 4:45:58 AM4/4/12
to xdocr...@googlegroups.com

Comment #4 on issue 97 by angelo.z...@gmail.com: Inline loop with
@before-row
http://code.google.com/p/xdocreport/issues/detail?id=97

Hi Roman,

Problem should be fixed (I have commited my work on Git and it will be
available on 0.9.8). Please test this fix and tell me if it's OK. Fix was
done on the BufferedTagElement class.

Regards Angelo

xdocr...@googlecode.com

unread,
Apr 4, 2012, 4:49:59 AM4/4/12
to xdocr...@googlegroups.com
Updates:
Owner: angelo.z...@gmail.com

Comment #5 on issue 97 by angelo.z...@gmail.com: Inline loop with
@before-row
http://code.google.com/p/xdocreport/issues/detail?id=97

(No comment was entered for this change.)

xdocr...@googlecode.com

unread,
Sep 28, 2012, 5:32:05 PM9/28/12
to xdocr...@googlegroups.com
Updates:
Status: Fixed

Comment #6 on issue 97 by angelo.z...@gmail.com: Inline loop with

xdocr...@googlecode.com

unread,
Aug 22, 2015, 2:10:23 AM8/22/15
to xdocr...@googlegroups.com

Comment #7 on issue 97 by xiro.p...@gmail.com: Inline loop with @before-row
https://code.google.com/p/xdocreport/issues/detail?id=97

Hello !

Could it possible to do something like :
Developer 1 Role 1
Role 2
-----------------
Developer 2 Role 1
-----------------
Developer 3 Role 1
Role 2

Thank you.


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

xdocr...@googlecode.com

unread,
Aug 23, 2015, 8:22:32 AM8/23/15
to xdocr...@googlegroups.com

Comment #8 on issue 97 by angelo.z...@gmail.com: Inline loop with
@before-row
https://code.google.com/p/xdocreport/issues/detail?id=97

Please create your issues at https://github.com/opensagres/xdocreport/issues
Reply all
Reply to author
Forward
0 new messages