2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Ryan - louier79 Subreport: PDF No Pages Error 2003-08-18 14:15 Hello, I am trying to use the subreport feature, but I keep receiving an error in Adobe Acrobat: "There was an error opening this document. This file cannot be opened because it has no pages. Here is the MasterReport.xml: ------------------------------ <jasperReport name="Bill_Master" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="612" pageHeight="792" columnWidth="612" columnSpacing="0" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <parameter name="Bill_Header" isForPrompting="true" class="dori.jasper.engine.JasperReport"/> <title> <band height="0"> </band> </title> <pageHeader> <band height="0"> </band> </pageHeader> <columnHeader> <band height="0"> </band> </columnHeader> <detail> <band height="260"> <subreport isUsingCache="false"> <reportElement mode="Transparent" x="0" y="0" width="612" height="260" forecolor="#000000" backcolor="#FFCC99" positionType="FixRelativeToTop" isPrintRepeatedValues="false" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <connectionExpression>$P{REPORT_CONNECTION}</connectionExpression> <subreportExpression class="dori.jasper.engine.JasperReport">$P{Bill_Header}</subreportExpression> </subreport> </band> </detail> <columnFooter> <band height="0"> </band> </columnFooter> <pageFooter> <band height="0"> </band> </pageFooter> <summary> <band height="0"> </band> </summary> </jasperReport> Subreport.xml: --------------- <jasperReport name="Bill_Header" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="612" pageHeight="260" columnWidth="612" columnSpacing="0" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <queryString><![CDATA[sELECT i.CAMPUS_ID, i.HEADER_MESSAGE1, i.HEADER_MESSAGE2, i.PAYMENT_ADDRESS, s.SID, s.ACTIVITY_THROUGH, s.AMOUNT_DUE, s.DATE_DUE, s.AMOUNT_PAID, s.STUDENT_NAME, s.BILL_RECORD_NUMBER FROM BRS_WEBBILLS_ACCOUNT_SUMMARY s, BRS_WEBBILLS_CAMPUS_INFO i WHERE s.SID = '522-31-6590' AND i.CAMPUS_ID = 'DN' AND s.ACTIVITY_THROUGH = to_date('03/14/03','MM/DD/YY') AND s.ACTIVITY_THROUGH = i.ACTIVITY_THROUGH]]></queryString> <field name="HEADER_MESSAGE1" class="java.lang.String"/> <field name="HEADER_MESSAGE2" class="java.lang.String"/> <field name="SID" class="java.lang.String"/> <field name="ACTIVITY_THROUGH" class="java.util.Date"/> <field name="AMOUNT_DUE" class="java.lang.String"/> <field name="DATE_DUE" class="java.util.Date"/> <field name="AMOUNT_PAID" class="java.lang.String"/> <field name="STUDENT_NAME" class="java.lang.String"/> <field name="PAYMENT_ADDRESS" class="java.lang.String"/> <field name="BILL_RECORD_NUMBER" class="java.lang.String"/> <background> <band height="0"> </band> </background> <title> <band height="0"> </band> </title> <pageHeader> <band height="0"> </band> </pageHeader> <columnHeader> <band height="260"> <staticText> <reportElement mode="Transparent" x="45" y="20" width="130" height="15" forecolor="#808080" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="Times-Roman" size="14" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>University of Colorado</text> </staticText> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="45" y="35" width="205" height="65" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{HEADER_MESSAGE1}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="335" y="25" width="230" height="75" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{HEADER_MESSAGE2}]]></textFieldExpression> </textField> <rectangle> <reportElement mode="Opaque" x="0" y="205" width="612" height="55" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <graphicElement stretchType="NoStretch" pen="None" fill="Solid" /> </rectangle> <rectangle> <reportElement mode="Opaque" x="45" y="100" width="522" height="25" forecolor="#000000" backcolor="#DDDDDD" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <graphicElement stretchType="NoStretch" pen="1Point" fill="Solid" /> </rectangle> <staticText> <reportElement mode="Transparent" x="60" y="103" width="59" height="10" forecolor="#000000" backcolor="#C0C0C0" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPEB.TTF" size="8" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>Student ID</text> </staticText> <staticText> <reportElement mode="Transparent" x="150" y="103" width="80" height="10" forecolor="#000000" backcolor="#C0C0C0" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPEB.TTF" size="8" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>Activity Through</text> </staticText> <staticText> <reportElement mode="Transparent" x="285" y="103" width="55" height="10" forecolor="#000000" backcolor="#C0C0C0" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPEB.TTF" size="8" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>Amount Due</text> </staticText> <staticText> <reportElement mode="Transparent" x="380" y="103" width="45" height="10" forecolor="#000000" backcolor="#C0C0C0" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPEB.TTF" size="8" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>Date Due</text> </staticText> <staticText> <reportElement mode="Transparent" x="470" y="103" width="55" height="10" forecolor="#000000" backcolor="#C0C0C0" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPEB.TTF" size="8" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>AMOUNT PAID</text> </staticText> <line direction="TopDown"> <reportElement mode="Opaque" x="440" y="100" width="0" height="25" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <graphicElement stretchType="NoStretch" pen="1Point" fill="Solid" /> </line> <staticText> <reportElement mode="Transparent" x="340" y="246" width="240" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="6" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="true" /> </textElement> <text><![CDATA[DETACH HERE AND RETURN UPPER PORTION WITH PAYMENT]]></text> </staticText> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="60" y="112" width="59" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["xxx-xx-" + $F{SID}.substring(7,11)]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="150" y="112" width="80" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[new SimpleDateFormat("MM/dd/yy").format($F{ACTIVITY_THROUGH})]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="#,###.##" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="285" y="112" width="55" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String">$F{AMOUNT_DUE}</textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="380" y="112" width="45" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Center" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[new SimpleDateFormat("MM/dd/yy").format($F{DATE_DUE})]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="481" y="112" width="40" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String">$F{AMOUNT_PAID}</textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="45" y="155" width="145" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String">$F{STUDENT_NAME}</textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="340" y="160" width="140" height="40" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <textFieldExpression class="java.lang.String">$F{PAYMENT_ADDRESS}</textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" > <reportElement mode="Transparent" x="340" y="213" width="240" height="15" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="Courier" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="true" /> </textElement> <textFieldExpression class="java.lang.String">$F{BILL_RECORD_NUMBER}</textFieldExpression> </textField> <staticText> <reportElement mode="Transparent" x="477" y="112" width="5" height="10" forecolor="#000000" backcolor="#FFFFFF" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/> <textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single"> <font fontName="sansserif" pdfFontName="LTYPE.TTF" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" isStrikeThrough="false" /> </textElement> <text>$</text> </staticText> </band> </columnHeader> <detail> <band height="0"> </band> </detail> <columnFooter> <band height="0"> </band> </columnFooter> <pageFooter> <band height="0"> </band> </pageFooter> <summary> <band height="0"> </band> </summary> </jasperReport> Thank you for your assistance and advice! By: Sohan Kasula - skasula RE: Subreport: PDF No Pages Error 2003-08-18 14:59 Probably there is no output through the SQL statement. If there is try using whenNoDataType="AllSectionsNoDetail" in the reports and go about trouble shooting the data. Hope this helps. By: Ryan - louier79 RE: Subreport: PDF No Pages Error 2003-08-18 15:23 Thank you, I added the whenNoDataType="AllSectionsNoDetail" line and it stopped the error message in Acrobat, but it displayed a blank page. When I run the subreport separtely, it prints out fine with all the results. Any other suggestions or advice? Thank you again! By: Gregory A. Swarthout - gswarthout RE: Subreport: PDF No Pages Error 2003-08-18 15:37 What data source are you passing into the master report? It has to have at least one row to get the detail section containing the subreport to print. By: Ryan - louier79 RE: Subreport: PDF No Pages Error 2003-08-18 15:57 The data source is the JRDataSource, a SQL query that I put into the iReport app. The subreport prints every field/row when printed separtely, but is blank when in the master report. Any other suggestions? Thank you again!!! By: Gregory A. Swarthout - gswarthout RE: Subreport: PDF No Pages Error 2003-08-18 16:09 I don't use iReport, so I'm not sure how much help I can give you on this. There isn't a queryString in your master report, so you're passing in a date source of type JRDataSource. JRDataSource is an interface, so what is the concrete type of the data source you are passing in? By: Ryan - louier79 RE: Subreport: PDF No Pages Error 2003-08-18 16:25 The subreport has the queryString, should it be in the subreport or the master report? I put the queryString in the master report, instead of the subreport and it still printed a blank page. (Note: the queryString was still in the subreport) Also, in the master report, I use the <connectionExpression>$P{REPORT_CONNECTION}</connectionExpression>, should I be using the REPORT_DATASOURCE instead? Thank you again!!! By: Gregory A. Swarthout - gswarthout RE: Subreport: PDF No Pages Error 2003-08-18 16:37 This is where you've reached the extend of my knowledge on the matter. Maybe someone else can step in a help you with this. But, just for testing purposes, come up with a queryString for the master report that is guaranteed to return exactly one row (maybe a sum() or count()) and leave everything else the way it is, and let me know what happens. By: Teodor Danciu - teodord RE: Subreport: PDF No Pages Error 2003-08-19 07:34 Hi, I suspect the master report receives a data source with no records in it, as Gregory pointed out already. Maybe a null datasource. In this case, the detail section of the master report never gets generated, even if you set whenNoDataType="AllSectionsNoDetail" for you master report. Note the "...NoDetail" part. A quick solution is to move the subreport from the detail section to the title section of the master report. I hope this helps. Teodor By: Ryan - louier79 RE: Subreport: PDF No Pages Error 2003-08-19 11:03 Hello, I tried moving the subreport to the title band and it will still not print. When I run the subreport separtely, it prints all the fields (i.e records in the resultset). I re-read the docs and came over dataSourceExpression, can you please provide same sample code (both master and subreport) with dataSourceExpression? My master report has the queryString, so should I use the dataSourceExpression or connectionExpression? Thank you again for your assistance!!! By: Teodor Danciu - teodord RE: Subreport: PDF No Pages Error 2003-10-05 02:32 Hi, <connectionExpression> is used to pass a connection object to the subreport in case the subreport has a query of its own inside. <dataSourceExpression> is used when there is no query inside the subreport and we pass a JRDataSource object directly. Usually, those two tags are not used simultaneously for the same <subreport>. I hope this helps. Teodor 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