Jump to content
We've recently updated our Privacy Statement, available here ×

net.sf.jasperreports.print.keep.full.text PROBLEM


coopni

Recommended Posts

Hi,

My report export to xls format reports. Here is my simple code:

         
            Connection conn = getConnection();
            JasperPrint print = JasperFillManager.fillReport("reports/SwapFeeExport.jasper", new HashMap(), conn);
         
            JRXlsExporter exporterXls = new JRXlsExporter ();
            exporterXls.setParameter(JRExporterParameter.JASPER_PRINT, print);   
            exporterXls.setParameter(JRExporterParameter.IGNORE_PAGE_MARGINS, true);
            // sets the export to have the grid lines, else default is white page.
            exporterXls.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, false);
            //Removes any unwanted columns.
            exporterXls.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, true);
            exporterXls.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"C:/demo2.xls");
            exporterXls.exportReport();   

The report xml starts with this:

<?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="report name" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">


    <property name="net.sf.jasperreports.print.keep.full.text" value="true"/>

    <queryString>

 

As you can see I have set the keep.full.text to true. The report runs using the above code, but when I try to open the demo2.xls file Excel complains with a info box saying, 'Excel found unreadable content in 'demo2.xls'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.'

When I click yes Excel then opens the report and informs me with another prompt saying, 'Excel was able to open the file by repairing or removing the unreadable content. Excel recovered your formulas and cell values, but some data may have been lost.

Looking at the report at the bottom I notice data missing. Removing <property name="net.sf.jasperreports.print.keep.full.text" value="true"/> from my report solves the problem and I do not have a corrupt or any of the above issues when opening the file, except obviously my report now does not have the print.keep.full.text functionality.

The version of Excel is Excel 2007 and the jar is jasperreports-3.5.3.jar

Any ideas on this??? Files attached.

Thanks,

Nick

 

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Seemed to have fixed the problem. I re-developed the report again within iReport and this time with no problems. I guess this could be a problem with iReport. I'm using version 3.6

Problem solved anyway, just scrapped the old report and re-built it and it worked second time.

Thanks.

Link to comment
Share on other sites

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