Jump to content

How to remove margins from Excel file


paatal

Recommended Posts

hi all,

is it possible to remove margins from Excel file ? or change margin size ?

i tried to do this but it does not helkp me :

JRXlsExporter exporter = new JRXlsExporter();           
ByteArrayOutputStream xlsReport = new ByteArrayOutputStream();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, xlsReport);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE, path);
exporter.setParameter(JRExporterParameter.IGNORE_PAGE_MARGINS, Boolean.TRUE);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, name);

exporter.exportReport();
byte bytes[] = xlsReport.toByteArray();
xlsReport.close();
OutputStream ouputStream = new FileOutputStream(path + File.separator + name);
ouputStream.write(bytes, 0, bytes.length);
ouputStream.flush();
ouputStream.close();

 

after this variable isIgnoreMarginPage into exporter instance is false ... why ?

 

_____________________

Regards,

Paata Lominadze.

Magticom LTD.

Link to comment
Share on other sites

  • Replies 13
  • Created
  • Last Reply

Top Posters In This Topic

Apparently IGNORE_PAGE_MARGINS does not remove left and right page margins when IS_ONE_PAGE_PER_SHEET is not set.  Log this as a bug.

As a workaround, you can set JRXlsAbstractExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS to true.

Regards,

Lucian



Post Edited by lucianc at 06/12/2009 15:43
Link to comment
Share on other sites

hi again,

i tryed everything but no success.

here is my code :

 

JRXlsExporter exporter = new JRXlsExporter();
                ByteArrayOutputStream xlsReport = new ByteArrayOutputStream();
                exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrintList);
                exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, xlsReport);
                exporter.setParameter(JRExporterParameter.OUTPUT_FILE, path);
                exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, name);
                exporter.setParameter(JRExporterParameter.IGNORE_PAGE_MARGINS, Boolean.TRUE);               
                exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
                exporter.setParameter(JRXlsAbstractExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);
                exporter.exportReport();

 

but margins still appeard ,,, what is here incorrect

 

IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS didn't help me ..

 

i need to decrease size of margins or remove (left and right) but i can't :(

 

___________________

Regards,

Paata Lominadze.

Magticom LTD.

Link to comment
Share on other sites

I ran your report with IGNORE_PAGE_MARGINS and IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS set to true, and the margins were removed.  Did you use different export parameters?  Also make sure that you don't have an old JR jar on your classpath.

Regards,

Lucian

Link to comment
Share on other sites

  • 10 months later...

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