Jump to content
Changes to the Jaspersoft community edition download ×

JasperViewer shows only the first page


Recommended Posts

By: marcopar - marcopar

JasperViewer shows only the first page

2003-12-23 09:14

Hi, i'm doing some simple tests on JasperReports and i'm having a problem with the viewer. It only shows the first page of the report. The page count is correct but all pages except the first are completely blank.

Pdx, html and xls are correctly generated.

 

Below there's the simple code i've used.

Thanks

ciao

 

 

 

 

JasperReport rep = JasperManager.loadReport("rep2.jasper");

JasperPrint jp = JasperFillManager.fillReport(rep, new HashMap(), AWVectorDataSource.getSampleDataSource());

 

 

JasperViewer.viewReport(jp, false);

 

//pdf

JasperExportManager.exportReportToPdfFile(jp, "ex.pdf");

//html

JasperExportManager.exportReportToHtmlFile(jp, "ex.html");

//excel

JRXlsExporter ex = new JRXlsExporter();

ex.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"ex.xls");

ex.setParameter(JRExporterParameter.JASPER_PRINT,jp);

ex.exportReport();

 

 

 

 

 

By: marcopar - marcopar

RE: JasperViewer shows only the first page

2003-12-29 09:14

More information. Commenting the piece of code shown below solves the problem. I don't know why but it seems to corrupt the JasperPrint object. If i use a dedicated JasperPrint object for the xls exporter, i can get all the stuff to work correctly. I will be very happy yo know why this thing is happening.

 

The version of JasperReports i'm using is 0.5.0

 

 

Here's the code that corrupts the JasperPrint (jp) object:

 

//excel

JRXlsExporter ex = new JRXlsExporter();

ex.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"ex.xls");

ex.setParameter(JRExporterParameter.JASPER_PRINT,jp2);

ex.exportReport();

 

 

 

 

 

By: Arun Kumar M - arunkumarm

RE: JasperViewer shows only the first page

2004-01-02 03:21

Hi,

 

The problem is with JRXlsExporter Class

What is happening is that, the y position of elements inside the pages in the JasperPrint Object are shifted by PageHeight * PageNumber. This corrupts the JasperPrint Object for further use.

 

In JRXlsExporter.exportReportToStream (line no: 353)

 

 

page = (JRPrintPage)pages.get(i);

 

elements = page.getElements();

if (elements != null && elements.size() > 0)

{

for(Iterator it = elements.iterator(); it.hasNext();)

{

element = (JRPrintElement)it.next();

//Here Element is modified, which corrupts

//the JasperPrint Object

element.setY(element.getY() + jasperPrint.getPageHeight() * i);

allPages.addElement(element);

}

}

 

Teodord, I am also stuck, please have a look.

 

Thanks,

Arun Kumar M

 

 

 

 

By: Teodor Danciu - teodord

RE: JasperViewer shows only the first page

2004-01-06 06:44

 

Hi,

 

This is solved in the CVS repository version.

 

Thank you,

Teodor

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...