Jump to content

Remove first empty column in Excel Export


rapthor

Recommended Posts

Hello,

I am exporting a JasperPrint to Excel inside my Java application. The file always contains an empty first column and an empty narrow column after the last data column (like a margin to the left and right of my actual data).

How do I remove these blank column automatically?

I attached the code that exports my report to Excel.

Code:
          ByteArrayOutputStream baos = new ByteArrayOutputStream();               JRXlsExporter exporterXLS = new JRXlsExporter();        exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, print);        exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, baos);        exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,                Boolean.FALSE);        exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE,                Boolean.FALSE);        exporterXLS.setParameter(                JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);        exporterXLS.setParameter(                JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,                Boolean.TRUE);        exporterXLS.setParameter(                JRXlsExporterParameter.IS_IGNORE_GRAPHICS,                Boolean.TRUE);               exporterXLS.setParameter(                JRXlsExporterParameter.IS_IGNORE_CELL_BORDER,                Boolean.TRUE);               exporterXLS.setParameter(                JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,                Boolean.TRUE);        exporterXLS.setParameter(                JRXlsExporterParameter.SHEET_NAMES,                sheetNames);               exporterXLS.exportReport();        return baos.toByteArray();
Link to comment
Share on other sites

  • Replies 1
  • 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...