coopni Posted March 2, 2010 Share Posted March 2, 2010 Hi,I have successfully got my reports working and being exported to xls format, but the resulting spreadsheet starts the report on column B and not Column A.I have set the following parameters, but nothing seems to help.Can someone please tell me how to start the excel report on column A and not B? Many thanks.Code:ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();JRXlsExporter exporterXls = new JRXlsExporter ();exporterXls.setParameter(JRXlsExporterParameter.JASPER_PRINT, print);exporterXls.setParameter(JRXlsExporterParameter.IGNORE_PAGE_MARGINS, false);exporterXls.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN, true);exporterXls.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, false);exporterXls.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, true);exporterXls.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, true);exporterXls.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, true);exporterXls.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, System.currentTimeMillis() + reportName + ".xls");exporterXls.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, byteArrayOutputStream);exporterXls.exportReport(); response.setContentType("application/vnd.ms-excel");response.setHeader("Content-Disposition", "attachment;filename=" + System.currentTimeMillis() + ".xls");ServletOutputStream servletOutputStream = response.getOutputStream();servletOutputStream.write(byteArrayOutputStream.toByteArray());servletOutputStream.flush();servletOutputStream.close(); Link to comment Share on other sites More sharing options...
coopni Posted March 3, 2010 Author Share Posted March 3, 2010 Can any one please tell me if there excel exports start on column A please? I need to know if this is possible asap and if I'm doing something not quite right.If I can not get the excel report to start the data on column A (for some reason it always starts on column b) I will have to re-write these reports in POI. Link to comment Share on other sites More sharing options...
coopni Posted March 5, 2010 Author Share Posted March 5, 2010 Can some one PLEASE tell me if there excel export reports are starting on column A at all? I really need to know if this is just how Jasper does things! If your reports exported to excel also start in column B please say!I really need to know if this is the functionality of Jasper Reports, because if so it does not meet requirements.I hope some one can please comment, even if it is just to say there export reports to Excel also start on column B.I have attached an example to what I am getting. Many thanks. Link to comment Share on other sites More sharing options...
coopni Posted March 5, 2010 Author Share Posted March 5, 2010 Problem fixed.IGNORE_PAGE_MARGINS does nothing, maybe a bug?Added IS_ONE_PAGE_SHEET to true and this solved my problem.Thanks for all the replies! Code: Post Edited by coopni at 03/05/2010 17:22 Link to comment Share on other sites More sharing options...
baggypants Posted March 6, 2010 Share Posted March 6, 2010 Well done for solving your problem. Just for your information, I have a report that starts with it's values in column A. However, Nearly everying in Column A is merged into column B.Did you try the CSV exporter? It dosn't suffer from quite so much table munging as the excel one. Also have a read of thishttp://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/faq.html?group_id=252#FAQ9 Finally. As the community is quite small and specialised please don't take any lack of response as a personal snub. Link to comment Share on other sites More sharing options...
coopni Posted March 8, 2010 Author Share Posted March 8, 2010 Thank you for your reply :-) and thanks for the article too, as some interesting stuff to know in it.I just want to share, just in case anyone else has the same problem, that the best solution to this is to mark the left and right margin lengths 0 leftMargin="0" rightMargin="0" on the jasperReport tag.I found using IS_ONE_PAGE_SHEET makes the excel report come out in 30 row max sheets, which wasn't really want I wanted. You can get around this by making the pageHeight attribute a higher number, but the real solution is to make the left and right margins zero, as above and not set IS_ONE_PAGE_SHEET to true.I assume that like me many people us iReport to make the reports and its not obvious unless you go to xml format to see what the margins are set to. Link to comment Share on other sites More sharing options...
baggypants Posted March 8, 2010 Share Posted March 8, 2010 I found page margines in the report inspector. click on the root element (right at the top) in the inspector tree to show report properties in the properties pane. Link to comment Share on other sites More sharing options...
rupalicancerian Posted January 24, 2014 Share Posted January 24, 2014 Remove left margin that will resolve this issue. Link to comment Share on other sites More sharing options...
rupalicancerian Posted January 24, 2014 Share Posted January 24, 2014 Remove left margin that will resolve this issue. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now