Java – the best way to include long static text in JasperReport/iReport

ireportjasper-reportsjava

My report contains 3 parts – 2 parts are quite straightforward table reports, and one part is contract agreement on about 10 pages, 10 pages of static formatted(bold headings) text. This contract agreement is usual agreement which consists of about 12 parts, where each part consists of heading and text, e.g.:


1. Part. Blab la bla
1.1 Some long long long text
1.2. Some more text here

1.5 Artart

2. Part some heading
2.1 Asdasdasd asdf adfas
and so on…


I thought that it will be quite simple to do, but…
I tried to add this as static text elements, but in such case there are few problems:

  • Static text element don’t expand! What means I need to do very long static text elements which also don’t work, as there is limit of height of Detail band to which I add elements.
  • It’s hard to style text if it’s all in one element;

I tried text field element as this elements successfully expand. But in such case it’s quite difficulty to change text in this element as all the text is in quotes and all the new lines should be done with “\n” or <BR>

Now I try the solution where I just create simple report with JasperReports and append contract agreement pdf to report pdf.

As I am quite new with JasperReport and IReport I assume that I just don’t understand something, as this seems to me quite “easy” feature. So what is the correct way of doing such thing in IReport? Maybe there is a way to “link” or embed so long text(as HTML, RTF or whatever) into report?
Thank You for Your time!

Best Answer

Don't use static text element, use text field, they can expand as the text grows.

Check the Stretch with Overflow checkbox in Text Field tab of the properties window.

Also, read this topic.