Jump to content

Hanging Indents


gdavej

Recommended Posts

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

 

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 15
  • Created
  • Last Reply

Top Posters In This Topic

  • 5 months later...

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 3 weeks later...

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 1 year later...
  • 5 years later...

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?

Link to comment
Share on other sites

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