Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JasperReports line spacing

I am developing a report with one Detail Band and one field that uses conditional styles. I am using Courier. The spacing between the lines is too large.

How can I minimize the space between the lines so the lines are nearly touching?

Below is the report XML.

<style name="DataHeaderTypeStyle">
    <conditionalStyle>
        <conditionExpression><![CDATA[$F{lineSectionType}==1]]></conditionExpression>
        <style fontName="Courier New" fontSize="11"/>
    </conditionalStyle>
    <conditionalStyle>
        <conditionExpression><![CDATA[$F{lineSectionType}==2]]></conditionExpression>
        <style fontName="Courier New" fontSize="7"/>
    </conditionalStyle>
</style>
<queryString>
    <![CDATA[]]>
</queryString>
<field name="lineSectionData" class="java.lang.String">
    <fieldDescription><![CDATA[lineSectionData]]></fieldDescription>
</field>
<field name="lineSectionType" class="java.lang.Integer">
    <fieldDescription><![CDATA[lineSectionType]]></fieldDescription>
</field>
<background>
    <band splitType="Stretch"/>
</background>
<detail>
    <band height="14" splitType="Stretch">
        <textField isStretchWithOverflow="true">
            <reportElement style="DataHeaderTypeStyle" positionType="Float" stretchType="RelativeToBandHeight" x="0" y="1" width="555" height="13">
                <printWhenExpression><![CDATA[$F{lineSectionType}==1 || $F{lineSectionType}==2]]></printWhenExpression>
            </reportElement>
            <textElement>
                <font fontName="Courier New" pdfFontName="Courier"/>
                <paragraph lineSpacing="Fixed"/>
            </textElement>
            <textFieldExpression><![CDATA[$F{lineSectionData}]]></textFieldExpression>
        </textField>
    </band>
</detail>

like image 979
steve garabedian Avatar asked Dec 08 '14 22:12

steve garabedian


1 Answers

Set Jaspersoft Studio properties for "Text field" or "Static text" as follows:

  • Line spacing for Proportional
  • Line Spacing Size to 0.4 (or similar)

The XML source should resemble:

<textElement>
    <font fontName="Courier"/>
    <paragraph lineSpacing="Proportional" lineSpacingSize="0.4"/>
</textElement>
like image 200
2 revs, 2 users 67% Avatar answered Nov 01 '22 18:11

2 revs, 2 users 67%