"Stretch with overflow" 子报表中的 textField 可以跨越多个页面吗?
Can a textField in subreport with "Stretch with overflow" span across multiple pages?
我有一个只有一个文本字段的子报表。此文本字段可以包含从服务中检索到的大约 5000 个字符。
我的目标是在父报表上显示此子报表。它应该从"Float"位置开始,我把它连续放置到多个页面。
当我的父报表中有此子报表时,当 "Stretch with overflow" 的 文本剪辑 =]子报表中的文本字段 设置为false。
当我将 "Stretch with overflow" 设置为 true 时, 文本字段在页面上显示为空白,但占用了所需的 space父报告。
我尝试了以下方法,但似乎没有任何效果:
1.子报表中:
- Print when detail overflow = true
- Split Type = "Stretch"
- Ignore pagination = true
2。主报告:
- Split Type = "Stretch"
- Print when detail overflow = true on subreport object
- Print in first whole band = true
试用了几天,感觉跨页文本框溢出是不可能的。
请让我知道是否有可能包含跨多个页面的文本字段的子报表。
"its even possible to have a subreport with text field to span across multiple pages?"
是的,我在下面附上一个例子
主报告
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="stretchTest" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="BlankPage" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="6c8cebac-a7b5-4dc2-abe8-e36b0cb184ca">
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\jdd\projects\StackTrace\jasper\"]]></defaultValueExpression>
</parameter>
<detail>
<band height="20" splitType="Stretch">
<subreport>
<reportElement x="0" y="0" width="100" height="20" uuid="778b107f-288e-4f17-915d-fed6f83a2805"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(2)]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "stretchTest_subreport.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>
子报表
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="stretchTest_subreport" pageWidth="100" pageHeight="555" orientation="Landscape" columnWidth="100" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="f716e850-ab6f-4668-b3a1-afe4823b8abf">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="veryLongTextThatNeedToBreak" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["I have a subreport with just one text field. This text field can have somewhere around 5000 characters retrieved from a service. My goal is to show this subreport on the parent report.(it should start from the Float position where I place it to multiple pages in a continuous manner). When I have this subreport in my parent report, the text clips when the Stretch with overflow of the text field in subreport is set to false. When I set Stretch with overflow to true, the text field appears blank on the pages but takes up the required space on the parent report. I have tried the following but nothing seem to work:1. In the sub report: Set the Print when detail overflow = true Set Split Type = Stretch Ignore pagination = true 2. Main report: Set Split Type = Stretch Set Print when detail overflow = true of subreport object Print in first whole band = true Trying it since few days has made me feel that it is impossible to have a overflowing text field across pages. Please let me know if its even possible to have a subreport with text field to span across multiple pages. Thanks in advance!!"]]></defaultValueExpression>
</parameter>
<detail>
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="100" height="20" uuid="4f14a231-dd62-465b-b10a-fa39f9c6a297"/>
<textFieldExpression><![CDATA[$P{veryLongTextThatNeedToBreak}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
编译子报表,设置子报表的正确路径并自行测试。
注意:我没有在 reportElement
上设置很多属性。
输出
我有一个只有一个文本字段的子报表。此文本字段可以包含从服务中检索到的大约 5000 个字符。
我的目标是在父报表上显示此子报表。它应该从"Float"位置开始,我把它连续放置到多个页面。
当我的父报表中有此子报表时,当 "Stretch with overflow" 的 文本剪辑 =]子报表中的文本字段 设置为false。 当我将 "Stretch with overflow" 设置为 true 时, 文本字段在页面上显示为空白,但占用了所需的 space父报告。
我尝试了以下方法,但似乎没有任何效果:
1.子报表中:
- Print when detail overflow = true
- Split Type = "Stretch"
- Ignore pagination = true
2。主报告:
- Split Type = "Stretch"
- Print when detail overflow = true on subreport object
- Print in first whole band = true
试用了几天,感觉跨页文本框溢出是不可能的。
请让我知道是否有可能包含跨多个页面的文本字段的子报表。
"its even possible to have a subreport with text field to span across multiple pages?"
是的,我在下面附上一个例子
主报告
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="stretchTest" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="BlankPage" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="6c8cebac-a7b5-4dc2-abe8-e36b0cb184ca">
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\jdd\projects\StackTrace\jasper\"]]></defaultValueExpression>
</parameter>
<detail>
<band height="20" splitType="Stretch">
<subreport>
<reportElement x="0" y="0" width="100" height="20" uuid="778b107f-288e-4f17-915d-fed6f83a2805"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(2)]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "stretchTest_subreport.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>
子报表
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="stretchTest_subreport" pageWidth="100" pageHeight="555" orientation="Landscape" columnWidth="100" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="f716e850-ab6f-4668-b3a1-afe4823b8abf">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="veryLongTextThatNeedToBreak" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["I have a subreport with just one text field. This text field can have somewhere around 5000 characters retrieved from a service. My goal is to show this subreport on the parent report.(it should start from the Float position where I place it to multiple pages in a continuous manner). When I have this subreport in my parent report, the text clips when the Stretch with overflow of the text field in subreport is set to false. When I set Stretch with overflow to true, the text field appears blank on the pages but takes up the required space on the parent report. I have tried the following but nothing seem to work:1. In the sub report: Set the Print when detail overflow = true Set Split Type = Stretch Ignore pagination = true 2. Main report: Set Split Type = Stretch Set Print when detail overflow = true of subreport object Print in first whole band = true Trying it since few days has made me feel that it is impossible to have a overflowing text field across pages. Please let me know if its even possible to have a subreport with text field to span across multiple pages. Thanks in advance!!"]]></defaultValueExpression>
</parameter>
<detail>
<band height="20" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="100" height="20" uuid="4f14a231-dd62-465b-b10a-fa39f9c6a297"/>
<textFieldExpression><![CDATA[$P{veryLongTextThatNeedToBreak}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
编译子报表,设置子报表的正确路径并自行测试。
注意:我没有在 reportElement
上设置很多属性。
输出