Jump to content
We've recently updated our Privacy Statement, available here ×

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


ryvo

Recommended Posts

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

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...