Jump to content
Changes to the Jaspersoft community edition download ×

report is export as a blank page.


2004 IR Help

Recommended Posts

By: evgenykravchenko - ekravche

report is export as a blank page.

2005-07-19 11:49

Hello I have the following code, and the following report definitions. However, my report is failing to export. All I get is a blank page.

 

<----------------------------- code begin ------------------------>

public void exportToPDF() {

String baseReportPath = "C:\samples\openreports\reportsamples\" ;

String xmlDataSourcePath = baseReportPath + "dataSource.xml";

String xmlJasperReportPath = baseReportPath + "SmallReport.xml";

String jrReportPath = baseReportPath + "SmallReport.jasper";

JRDataSource ds = null;

try {

ds = new JRXmlDataSource(new BufferedInputStream(new FileInputStream(xmlDataSourcePath)), "/rootNode/a/Name");

} catch ( FileNotFoundException e ) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch ( JRException e ) {

// TODO Auto-generated catch block

e.printStackTrace();

}

 

 

JasperReport jr =null;

try {

jr = (JasperReport)JRLoader.loadObjectFromLocation(jrReportPath);

}

catch ( JRException e1 ) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

 

 

try {

JasperPrint jp = JasperFillManager.fillReport(jr, null,ds);

JasperExportManager.exportReportToPdfFile(jp, "c:\test.pdf");

 

}

catch ( JRException e2 ) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

 

}

 

<----------------------------- code end ------------------------>

 

 

<----------------------------- report def begin ------------------------>

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport name="SmallReport" pageWidth="595" pageHeight="842" columnWidth="540" columnSpacing="15" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30">

<reportFont name="ReportFont0" isDefault="false" fontName="sansserif" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

<field name="Name" class="java.lang.String">

<fieldDescription><![CDATA[Client's name]]></fieldDescription>

</field>

<title>

<band height="50">

<staticText>

<reportElement positionType="Float" x="31" y="7" width="492" height="36"/>

<textElement textAlignment="Center">

<font fontName="sansserif" size="18" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

</textElement>

<text><![CDATA[simple Report]]></text>

</staticText>

</band>

</title>

<columnHeader>

<band height="20">

<staticText>

<reportElement positionType="Float" x="4" y="2" width="102" height="13"/>

<textElement>

<font isUnderline="true"/>

</textElement>

<text><![CDATA[NAME]]></text>

</staticText>

</band>

</columnHeader>

<detail>

<band height="20">

<textField isStretchWithOverflow="true">

<reportElement positionType="Float" x="4" y="3" width="200" height="12"/>

<textElement>

<font fontName="sansserif" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{Name}]]></textFieldExpression>

</textField>

</band>

</detail>

<pageFooter>

<band height="40">

<rectangle>

<reportElement positionType="Float" x="227" y="16" width="0" height="0"/>

<graphicElement/>

</rectangle>

</band>

</pageFooter>

</jasperReport>

 

 

<----------------------------- report def end ------------------------>

 

Any help regarding this is appreciated

 

 

 

 

By: evgenykravchenko - ekravche

RE: report is export as a blank page.

2005-07-19 11:50

oh, my datasource looks like this

 

<----------------------------- datasource begin ------------------------>

<rootNode>

<A>

<Name>testone</Name>

<Name>testtwo</Name>

</A>

<A>

<Name>testthree</Name>

<Name>testfour</Name>

</A>

</rootNode>

 

 

<----------------------------- datasource end ------------------------>

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...