Hanging Indents

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.

  1. 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

 

gdavej's picture
7
Joined: Nov 28 2006 - 11:43am
Last seen: 16 years 10 months ago

15 Answers:

I am having the same problem. Is there any solution to this?

 

-Guido

malpohl's picture
419
Joined: Feb 26 2010 - 4:52am
Last seen: 9 years 6 months ago

Do not think it is possible. Look in JRStyledTextParser.java and search for "u2022".

The code simply finds all <li> tags and replaces them wtih the bullet character (\\u2022) and all </li> with a newline character (\\n).

The markup tags are discarded.

uhurusurfa's picture
Joined: Oct 10 2006 - 3:25am
Last seen: 3 years 3 months ago

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's picture
419
Joined: Feb 26 2010 - 4:52am
Last seen: 9 years 6 months ago

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

lucianc's picture
87103
Joined: Jul 17 2006 - 1:10am
Last seen: 3 hours 6 min ago

I have the same requirement.

has the patch been uploaded to the trackers and/or has it been integrated in Jasper?

 

If not,  Guido, could you share your code with us? I think there are many out there with the same requirements and this issue.

 

Thanks,

Tom

 

 

curse's picture
384
Joined: Aug 30 2010 - 7:07am
Last seen: 13 years 4 weeks ago

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
malpohl's picture
419
Joined: Feb 26 2010 - 4:52am
Last seen: 9 years 6 months ago

Hi Guido

Thanks for the reply.

 

If you don't mind you can perhaps attach your solution here instead of on the tracker?

That way you can attach the later version supporting nested lists.

 

Just a thought, but would be really helpful for me,

Thanks

Tom

 

 

 

curse's picture
384
Joined: Aug 30 2010 - 7:07am
Last seen: 13 years 4 weeks ago

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
malpohl's picture
419
Joined: Feb 26 2010 - 4:52am
Last seen: 9 years 6 months ago

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....

curse's picture
384
Joined: Aug 30 2010 - 7:07am
Last seen: 13 years 4 weeks ago

That looks like I known problem which is already fixed - or at least I thought so. It can only happen if the procedure is trying to replace something that was already replaced. Can you send me the document you are trying to process?

-Guido

malpohl's picture
419
Joined: Feb 26 2010 - 4:52am
Last seen: 9 years 6 months ago

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

curse's picture
384
Joined: Aug 30 2010 - 7:07am
Last seen: 13 years 4 weeks ago

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:

  1. we need this requirement -> we will be adapting the jasper codebase
  2. 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?

curse's picture
384
Joined: Aug 30 2010 - 7:07am
Last seen: 13 years 4 weeks ago

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
malpohl's picture
419
Joined: Feb 26 2010 - 4:52am
Last seen: 9 years 6 months ago

 Is there a solution to the hanging indent for the JasperReport <li> tags now?  I have been trying to fix this issue without any success.

mhou's picture
101
Joined: Jun 12 2012 - 4:45pm
Last seen: 11 years 3 months ago

Has this still not made it's way into the product?

At ~ v6.1 or some version pre 6.4.3, this was possible using First Line Indent + Left Indent and a negative value. 

Now, the negative value is ignored the version we currently use, 6.4.3. What's going on?

jswizardry's picture
Joined: Jul 31 2015 - 5:58am
Last seen: 3 years 6 months ago
Feedback