I have a very long static test. in my main jrxml (detail band), i created a sub-report to print this long static text. The output format is PDF. The long text is printed until the end of page, and then continue to next page. However, there some wording that had been left out / truncated in the next page.
ex. here is a very long long long static1 text long static2 text static3 static4
PDF output, page 1, it printed ("here is a very long long long static1"). But in page 2, it continue printed start with ("static3 static4"). few words are missing/truncated
This is the main jrxml. it has a frame defined. and inside this frame, will have subreport defined.
<frame>
<reportElement
x="18"
y="472"
width="819"
height="198"
key="frame-4"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<subreport isUsingCache="true">
<reportElement
mode="Transparent"
x="3"
y="31"
width="350"
height="12"
key="subreport-21"
positionType="Float"
isRemoveLineWhenBlank="true"
isPrintInFirstWholeBand="true"/>
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/PrintOrders/StructuredNote[NoteID='ST']")]]></dataSourceExpression>
<subreportExpression class="java.lang.String"><![CDATA["/print/FullPrint.jasper"]]></subreportExpression>
</subreport>
</frame>
this is the sub-report jrxml
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="FullPrint"
columnCount="1"
printOrder="Vertical"
orientation="Landscape"
pageWidth="842"
pageHeight="595"
columnWidth="842"
columnSpacing="0"
leftMargin="0"
rightMargin="0"
topMargin="0"
bottomMargin="0"
whenNoDataType="NoPages"
scriptletClass="JasperUtil"
isTitleNewPage="false"
isSummaryNewPage="false"
resourceBundle="AllBundles">
<property name="ireport.scriptlethandling" value="2" />
<property name="ireport.encoding" value="UTF-8" />
<import value="java.util.*" />
<import value="net.sf.jasperreports.engine.*" />
<import value="net.sf.jasperreports.engine.data.*" />
<parameter name="SUBREPORT_DIR" isForPrompting="true" class="java.lang.String">
<defaultValueExpression ><![CDATA[".\\"]]></defaultValueExpression>
</parameter>
<queryString language="xPath"><![CDATA[PrintOrders/PrintOrder/PurchaseOrder]]></queryString>
<field name="BLBST" class="java.lang.String">
<fieldDescription><![CDATA[./GeneralNote]]></fieldDescription>
</field>
<field name="PoNumber" class="java.lang.String">
<fieldDescription><![CDATA[./PoHeader/PoNumber]]></fieldDescription>
</field>
<sortField name="BLBScheduleId" />
<group name="PurchaseOrder" isReprintHeaderOnEachPage="true" >
<groupExpression><![CDATA[$F{PoNumber}]]></groupExpression>
<groupHeader>
<band height="0" isSplitAllowed="true" >
</band>
</groupHeader>
<groupFooter>
<band height="0" isSplitAllowed="true" >
</band>
</groupFooter>
</group>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="0" isSplitAllowed="true" >
</band>
</title>
<pageHeader>
<band height="0" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="0" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="17" isSplitAllowed="true" >
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="3"
y="2"
width="821"
height="13"
key="textField-279"
positionType="Float"
isRemoveLineWhenBlank="true"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font pdfFontName="Helvetica" size="9" isBold="false"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_SCRIPTLET}.doReplaceStringWithNewlineChar($F{BLBST})]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="0" isSplitAllowed="true" >
</band>
</pageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>
here is what i have done and which already set.
for the text box of the subreport, set "Stretch with Overfow" = true and "position type" = Float
for the sub-report element in the main jrxml, i set "Position type" = Float and "Stretch Type"=no
I had try and error, lots of other config combination, for instance
- Position Type = Float
- Strech Type = Relative to tallest object or Relative to band height
- Stretch with overflow = true
There other post in this forum, and i had tried most of them suggestion except for this below
- setting font name same as pdf font name. because there is no value in both drop down selection list, that had same value in both drop down list
Here is the screen-cap. The top is the page 1, and there is a very long text which will then overflow to the next page. But, on the second page, the continuous sentence of text had been truncated.