Jasper Report HTML bullet hanging indent
Asked Answered
A

2

2

I have a Jasper report which uses HTML markup tag to display the li tag list. However, it seems that even with the latest version of the Jasper report, it still cannot do the hanging indent correctly.

This is what I want:

  • TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST
    • test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test

This is what I get:

* TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST

   * test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test

I have this in the jrxml:

<detail>
            <band height="20"  isSplitAllowed="true" >
                <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        mode="Transparent"
                        x="32"
                        y="2"
                        width="458"
                        height="16"
                        forecolor="#000000"
                        backcolor="#FFFFFF"
                        key="textField"
                        stretchType="RelativeToTallestObject"
                        isPrintWhenDetailOverflows="true"/>
                    <box></box>
                    <textElement markup="html" lineSpacing="Single">
                        <font fontName="Arial" pdfFontName="Helvetica" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$F{message}]]></textFieldExpression>
                </textField>
            </band>
        </detail>

I have this in the message variable:

<ul><li>TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST<ul><li>test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test </li></ul></li></ul> 

Any idea how I can have those bullets having hanging indented?

Thank you, Michael

Acord answered 14/6, 2012 at 0:3 Comment(0)
N
1

I was able to achieve this by combining negative tab indent on the first line (text field page) with an equal left padding (borders page)

enter image description here

Naphtha answered 1/12, 2014 at 15:2 Comment(2)
this works only in preview.. upon compiling from java code it, alignment becomes a messEkaterinburg
This works only for unordered lists <ul>. If you do this for ordered lists, the horizontal positioning of the text after the "bullet" character (a,b,c,....) is depending on the width of the "bullet" character. E.G. an "m" is wider than an "i" and therefore pushes the text on the 1st line more to the right.Venus
H
0

That is possible with padding of the element:

Padding Dialog iReport

            <textField isBlankWhenNull="true">
            <reportElement x="170" y="10" width="400" height="15"/>
            <box leftPadding="5">
                <topPen lineWidth="0.0"/>
                <leftPen lineWidth="0.0"/>
            </box>
            <textElement>
                <font fontName="Times New Roman" size="10" pdfEncoding="Cp1250"/>
            </textElement>
            <textFieldExpression class="java.lang.String"><![CDATA[$F{TASK_NAME}]]></textFieldExpression>
        </textField>
Hite answered 5/11, 2012 at 9:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.