I'm creating a report with a lot of text, numbered lists and bulleted lists. I tried using html markup for the lists, but when the text on a list item spills over to a second line, the second line doesn't show the hanging indent.
- This is what I want to see, This is what I want to see, This is what I want to see, This is what I want to see, This is what I want to see, This is what I want to see, This is what I want to see, This is what I want to see, This is what I want to see.
1. and this is what I see, and this is what I see, and this is what I see, and this is what I see, and this is what I see, and this is what I see,
Is there any way that I can get the list items to display correctly (ie like the first example above)?
Cheers
David
15 Answers:
In the meantime I have written a patch that enables not only hanging indents, but also tables.
I am willing to contribute this, if the JasperReports architects are interested?
Regards,
-Guido
Solution idea: To enable the indetation I am changing the document structure on the fly by replacing a single text box by a number of text boxes, one for every (indetented) paragraph.
Post Edited by malpohl at 08/10/2010 12:24
malpohl
Wrote:
In the meantime I have written a patch that enables not only hanging indents, but also tables. I am willing to contribute this, if the JasperReports architects are interested? |
We're of course interested in contributions. Please upload your patch via the project trackers.
Thank you,
Lucian
Yes, I will share, but the problem is that I am quite busy at the moment. I will try and upload something this week.
It probably will be the old version which can not do nested indentations, because the newest one uses JDOM and I am not sure if that is OK with the architects. (The JDOM version can also do tables...)
-Guido
Post Edited by malpohl at 08/30/2010 14:19
OK, here is something... It is the whole 3.7.2 distribution including all my changes which can be found in the JasperReports/src/net/sf/jasperreports/engine/fill/ directory.
I included the jasperreports.jar which can be used right away - if you dare to use it.
This is the complete version which uses JDOM to parse, so I included it as well. I removed the other libs though...
-Guido
Post Edited by malpohl at 08/31/2010 09:39
Thanks alot Guido,
im digging into the code now since I have stackoverflow:
....
at net.sf.jasperreports.engine.fill.JRFillTextFieldFrame.prepare(JRFillTextFieldFrame.java:147)
at net.sf.jasperreports.engine.fill.JRFillTextFieldFrame$JRFillTextFieldElements.prepareElements(JRFillTextFieldFrame.java:312)
at net.sf.jasperreports.engine.fill.JRFillTextFieldFrame.prepare(JRFillTextFieldFrame.java:147)
at net.sf.jasperreports.engine.fill.JRFillTextFieldFrame$JRFillTextFieldElements.prepareElements(JRFillTextFieldFrame.java:312)
at net.sf.jasperreports.engine.fill.JRFillTextFieldFrame.prepare(JRFillTextFieldFrame.java:147)
at net.sf.jasperreports.engine.fill.JRFillTextFieldFrame$JRFillTextFieldElements.prepareElements(JRFillTextFieldFrame.java:312)
at net.sf.jasperreports.engine.fill.JRFillTextFieldFrame.prepare(JRFillTextFieldFrame.java:147)
....
I'll let know if I find a solution....
Seems to be related to how you create the list
if I do something like this:
<ol>
<li>item 1</li>
<li>item 2</li>
</ol>
I get the stack overflow, this however does work:
<li>some text
<li>nested 1</li>
<li> nested 2</li>
</li>
I was doing the first style, since we need support for both bullet and numbered lists. Can you verify this?
example doc in attachment.
- Tom
Is Lucian or any of the other devs following this discussion?
I would like to propose to integrate these features into the jasper codebase.
The reason is simple:
- we need this requirement -> we will be adapting the jasper codebase
- we want to be able to easily upgrade our jasper versions in the future
I also believe this is a feature many people would like. So if implemented correctly, it could benefit everyone.
If the jasper dev's can agree, maybe they can give us some extra information.
eg. what do you expect from the feature regarding complexity, what third party libs can be used (eg. jdom in Guido's current implementation, ...)
We ourselves need numbered lists, bullet lists (both nested) and indented paragraphs (eg. <p margin="20px">...)
Guido, what about the code you attached, can we freely use it and perhaps integrate into Jasper?
OK, obviously my parser is not as robust as it ought to be. My excuse is that in our application we have a different parser generating the field contents, so that I am not really confronted with "illegal" syntax.
Obviously I have to put some additional work into error-handling.
Currently only "li" tags for lists are supported. example:
<li>fist item, first level
<li>first item, second level</li></li>
<li>second item, first level</li>
...
Numbered lists are not supported (but could be easily).
Indented paragraphs are not supported (but could be easily).
For more information please take a look at the JavaDoc of net.sf.jasperreports.engine.fill.rtfextension.StyledTextFieldExtension where I explain what is allowed (understood) and what is not.
-Guido
Post Edited by malpohl at 09/02/2010 12:16