How to split solid text from datasource to chunks and print each chunk on a separate page?

0

Good day. I have a XML file that contains element named TextOutput. This elements occurs just once in the XML. It contains a plain text but special about the text is that lines (they are all 80 characters long) are concatenated together without any separators (no line feeds or so). I need to split the text into individual lines and then print 60 lines per page. But I don't know how to achieve this.

What I have done so far using Using Jaspersoft Studio 5.6.2:

  1. I'v defined the data adapter of type XML document read the entire text
  2. I'v also defined a dataset that has one field which uses an xPath to get value of element TextOutput from the XML
  3. I'v created variable textOutput (java.util.Collection) within the report
  4. I'v created class extending JRDefaultScriptlet
  5. In method afterDetailEval() I split TextOutput text into individual lines, then I group them by 60 (meaning I concatenated them using "\n" separator) and I set the textOutput resulting List of Strings where each item (String) represents a page.
  6. I'v placed TextFiled on the form and set it's expression to $V{textOutput}

But It prints the first page only on which more then 60 lines appears.

Please advise. Many thanks. Vojtech

 

ryvo's picture
2
Joined: Dec 17 2014 - 3:16am
Last seen: 7 months 1 week ago

0 Answers:

No answers yet
Feedback