Jasper Report HTML bullet hanging indent

前提是你 提交于 2019-12-20 03:21:54

问题


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


回答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)




回答2:


That is possible with padding of the element:

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


来源:https://stackoverflow.com/questions/11025092/jasper-report-html-bullet-hanging-indent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!