This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Apache POI :Export to xls(Coloured Cell) not working in MS Excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Apache POI :Export to xls(Coloured Cell) not working in MS Excel" Watch "Apache POI :Export to xls(Coloured Cell) not working in MS Excel" New topic
Author

Apache POI :Export to xls(Coloured Cell) not working in MS Excel

Vishu Singhvi
Greenhorn

Joined: Jan 31, 2012
Posts: 2
0 down vote favorite
share [g+] share [fb] share [tw]


I am working on the export functionality in the Apache POI. The "Export to xls" colour functionality is not working in the MS Excel where as it is working in the Open Office.

I am trying to export using the ServletOutputStream and accordingly trying to get the desired "Coloured Cell" on the Excel Sheet.

The coloured cell is being shown in the Open Office but is not being shown in the MS Excel.

Code Which i am using for writing a file:--

response.setContentType("application/xls");
response.setContentLength( myWorkBook.getBytes().length);
response.setHeader("Content-Disposition", "attachment;filename=Report.xls");
response.getOutputStream().write( myWorkBook.getBytes(), 0, myWorkBook.getBytes().length);
response.getOutputStream().flush();
response.getOutputStream().close();

Please Help
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Please BeForthrightWhenCrossPostingToOtherSites: http://stackoverflow.com/questions/9079391/apache-poi-export-to-xls-not-working-in-ms-excel


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Vishu Singhvi
Greenhorn

Joined: Jan 31, 2012
Posts: 2
I am generating the file and finally got the help.
Using "OutputStream" class we have write the file o=into the "HSSFWorkbook" and now its working fine. Thanks for the replies
 
Don't get me started about those stupid light bulbs.
 
subject: Apache POI :Export to xls(Coloured Cell) not working in MS Excel
 
Similar Threads
Data export from Java to Office
How to output JSP page to Excel ?
How to read Microsoft Excel (97, 2003, 2007) through OpenOffice API
Read MS Excel Sheet Formula Execution Value Without Opening it
How to open the MS-Excel file using servlet/struts action class