Matthias.delamare Posted July 10, 2019 Share Posted July 10, 2019 Hello,We have several OLE documents that are stocked in a database.After declaring our datasource and <querystring> in our report, we use <subreport> with <subreportParameter name="oleObjectId"> in the <detail> section in order to print each document one after the otherDue to double sided printing, we need to add an empty blank page between each OLE documents, to be sure that all OLE documents will be printed in a separate sheet. For the now, two documents that are one page length are printed out on the same sheet whereas recipients are different physical persons.How can we tell Jasper to add a blank page (two consecutive page breaks) between two OLE documents?If anyone has an idea? Link to comment Share on other sites More sharing options...
Matthias.delamare Posted July 10, 2019 Author Share Posted July 10, 2019 FYI, I use Jasper Report v6.8.0 Link to comment Share on other sites More sharing options...
szaharia Posted July 12, 2019 Share Posted July 12, 2019 The detail section can contain multiple bands, so you could insert a second detail band that contains 2 Break elements with an empty Static Text element between them. See the attachment. Link to comment Share on other sites More sharing options...
Matthias.delamare Posted July 12, 2019 Author Share Posted July 12, 2019 Hello,Thank you for your response. I tested your solution, but it does not provide the expected result. I put the custom message "Page let empty intentionally" in the text field, and the result is the following :PAGE BREAKPage let empty intentionallyPAGE BREAKPAGE BREAKPage let empty intentionallyPAGE BREAKPAGE BREAKPage let empty intentionallyPAGE BREAKOLE DOCUMENT #1PAGE BREAKOLE DOCUMENT #2PAGE BREAKOLE DOCUMENT #3PAGE BREAKOLE DOCUMENT #4How can I tell Jasper to execute elements in the expected order (DOC #1 then "Page let empty intentionally" then DOC #2 then "Page let empty intentionally", ...) ? Link to comment Share on other sites More sharing options...
szaharia Posted July 12, 2019 Share Posted July 12, 2019 Well, in this case it would be very useful if you could post your JRXML file here, in order to illustrate the report layout in your case.Thank you,Sanda Link to comment Share on other sites More sharing options...
Matthias.delamare Posted July 12, 2019 Author Share Posted July 12, 2019 Ok. Here it is. I hid sensitive values with XXXXX and YYYYY<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b --><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="GET_ALL_LINKED_DOCUMENTS" pageWidth="612" pageHeight="842" columnWidth="612" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Empty" uuid="de603a7d-4403-4173-a4b9-61aecb96f406"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <property name="net.sf.jasperreports.print.create.bookmarks" value="false"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="XXXXX.xml"/> <parameter name="XXXXX_PARAM1" class="java.lang.String" isForPrompting="false"> <parameterDescription><![CDATA[]]></parameterDescription> </parameter> <parameter name="XXXXX_PARAM2" class="java.lang.String" isForPrompting="false"> <parameterDescription><![CDATA[]]></parameterDescription> </parameter> <parameter name="STYLE_TEMPLATE" class="java.net.URL" isForPrompting="false"/> <parameter name="RESOURCE_PATH" class="java.lang.String" isForPrompting="false"/> <queryString> <![CDATA[select OLE_OBJECT_ID from XXX where XXX=XXXXX_PARAM1 and YYY=XXXXX_PARAM2]]> </queryString> <field name="OLE_OBJECT_ID" class="java.lang.String"> <property name="com.jaspersoft.studio.field.label" value="OLE_OBJECT_ID"/> </field> <background> <band splitType="Stretch"/> </background> <detail> <band height="50"> <break> <reportElement x="0" y="0" width="99" height="1" uuid="3021991e-c925-4824-bded-d63f881cb0cc"> <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> </break> <staticText> <reportElement x="10" y="10" width="590" height="30" uuid="e46db91c-5d68-4247-a3fa-9b28b57b8fb0"> <property name="com.jaspersoft.studio.unit.y" value="px"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> </reportElement> <textElement textAlignment="Center"> <font size="14" isBold="false"/> </textElement> <text><![CDATA[Page let empty intentionally]]></text> </staticText> <break> <reportElement x="0" y="45" width="100" height="1" uuid="ea27cdf9-58ca-491e-be0c-7872b3cfdbbd"> <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> </break> </band> <band height="20" splitType="Stretch"> <subreport isUsingCache="true" runToBottom="true"> <reportElement positionType="Float" mode="Transparent" x="0" y="0" width="612" height="20" isRemoveLineWhenBlank="true" uuid="b41ae55d-d96a-4a8e-8854-afa8f8db4904"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> </reportElement> <subreportParameter name="oleObjectId"> <subreportParameterExpression><![CDATA[$F{OLE_OBJECT_ID}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="STYLE_TEMPLATE"> <subreportParameterExpression><![CDATA[$P{STYLE_TEMPLATE}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="RESOURCE_PATH"> <subreportParameterExpression><![CDATA[$P{RESOURCE_PATH}]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA[LOADSUB("GenericSubreportOleAttachment.jasper")]]></subreportExpression> </subreport> </band> </detail></jasperReport>[/code]And the GenericSubreportOleAttachment.jasper file :<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b --><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="GenericSubreportOleAttachment" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="0" rightMargin="40" topMargin="0" bottomMargin="0" whenResourceMissingType="Key" uuid="d05f9809-412a-46c1-8be6-02664ba8332b"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="XXXXX.xml"/> <parameter name="oleObjectId" class="java.lang.String"> <parameterDescription><![CDATA[OLE Object ID]]></parameterDescription> </parameter> <parameter name="STYLE_TEMPLATE" class="java.net.URL" isForPrompting="false"/> <parameter name="RESOURCE_PATH" class="java.lang.String" isForPrompting="false"/> <parameter name="documentLoaded" class="java.lang.Boolean" isForPrompting="false"> <parameterDescription><![CDATA[Loaded Flag]]></parameterDescription> <defaultValueExpression><![CDATA[LOADDOCUMENT($P{oleObjectId})]]></defaultValueExpression> </parameter> <queryString language="SQL"> <![CDATA[select $P{oleObjectId}from dual]]> </queryString> <field name=":1" class="java.lang.String"> <property name="com.jaspersoft.studio.field.label" value=":1"/> </field> <background> <band splitType="Stretch"/> </background></jasperReport>[/code] Link to comment Share on other sites More sharing options...
szaharia Posted July 12, 2019 Share Posted July 12, 2019 Thank you. The detail band with the Break elements needs to be placed after the band containing the subreport in the JRXML. Something like: <detail> <band height="20" splitType="Stretch"> <subreport isUsingCache="true" runToBottom="true"> ... </subreport> </band> <band height="50"> <break> ... </break> <staticText> ... </staticText> <break> ... </break> </band> </detail> Link to comment Share on other sites More sharing options...
Matthias.delamare Posted July 12, 2019 Author Share Posted July 12, 2019 Ok, I inverted the two <band> elements, but it does not changes anything, I always have all the blank pages ("Page let empty intentionally") then all OLE documents after.Here is my code now : <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b --><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="GET_ALL_LINKED_DOCUMENTS" pageWidth="612" pageHeight="842" columnWidth="612" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Empty" uuid="de603a7d-4403-4173-a4b9-61aecb96f406"> <property name="com.jaspersoft.studio.data.sql.tables" value=""/> <property name="net.sf.jasperreports.print.create.bookmarks" value="false"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="XXXXX.xml"/> <parameter name="XXXXX_PARAM1" class="java.lang.String" isForPrompting="false"> <parameterDescription><![CDATA[]]></parameterDescription> </parameter> <parameter name="XXXXX_PARAM2" class="java.lang.String" isForPrompting="false"> <parameterDescription><![CDATA[]]></parameterDescription> </parameter> <parameter name="STYLE_TEMPLATE" class="java.net.URL" isForPrompting="false"/> <parameter name="RESOURCE_PATH" class="java.lang.String" isForPrompting="false"/> <queryString> <![CDATA[select OLE_OBJECT_ID from XXX where XXX=XXXXX_PARAM1 and YYY=XXXXX_PARAM2]]> </queryString> <field name="OLE_OBJECT_ID" class="java.lang.String"> <property name="com.jaspersoft.studio.field.label" value="OLE_OBJECT_ID"/> </field> <background> <band splitType="Stretch"/> </background> <detail> <band height="20" splitType="Stretch"> <subreport isUsingCache="true" runToBottom="true"> <reportElement positionType="Float" mode="Transparent" x="0" y="0" width="612" height="20" isRemoveLineWhenBlank="true" uuid="b41ae55d-d96a-4a8e-8854-afa8f8db4904"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> </reportElement> <subreportParameter name="oleObjectId"> <subreportParameterExpression><![CDATA[$F{OLE_OBJECT_ID}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="STYLE_TEMPLATE"> <subreportParameterExpression><![CDATA[$P{STYLE_TEMPLATE}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="RESOURCE_PATH"> <subreportParameterExpression><![CDATA[$P{RESOURCE_PATH}]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> <subreportExpression><![CDATA[LOADSUB("GenericSubreportOleAttachment.jasper")]]></subreportExpression> </subreport> </band> <band height="50"> <break> <reportElement x="0" y="0" width="99" height="1" uuid="3021991e-c925-4824-bded-d63f881cb0cc"> <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> </break> <staticText> <reportElement x="10" y="10" width="590" height="30" uuid="e46db91c-5d68-4247-a3fa-9b28b57b8fb0"> <property name="com.jaspersoft.studio.unit.y" value="px"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> </reportElement> <textElement textAlignment="Center"> <font size="14" isBold="false"/> </textElement> <text><![CDATA[Page let empty intentionally]]></text> </staticText> <break> <reportElement x="0" y="45" width="100" height="1" uuid="ea27cdf9-58ca-491e-be0c-7872b3cfdbbd"> <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> </break> </band> </detail></jasperReport>[/code]Any idea? Link to comment Share on other sites More sharing options...
Matthias.delamare Posted July 16, 2019 Author Share Posted July 16, 2019 Hello, do you have an idea to fix the issue? I just want to add two page breaks between two OLE documents. See the code above. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now