File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Excel Writing Using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "Excel Writing Using Java" Watch "Excel Writing Using Java" New topic
Author

Excel Writing Using Java

A.S. HariLal
Greenhorn

Joined: Oct 24, 2007
Posts: 28
Dear Friends,
When I try to write data to excel i got the following exception
org.apache.poi.hssf.usermodel.HSSFCell cannot be cast to java.lang.String

code is like

If there is any solution, please help me
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12269
    
    1
headerCell.setCellValue(new HSSFRichTextString(titleArray.get(cnt))); // Exception is happening here


What is the type of titleArray?


Java Resources at www.wbrogden.com
A.S. HariLal
Greenhorn

Joined: Oct 24, 2007
Posts: 28
String is the type
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

Another step to take is to split the line into:



Is it now clear exactly where the error is and what it is?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
A.S. HariLal
Greenhorn

Joined: Oct 24, 2007
Posts: 28
Thank you...now it's working
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3268

You're welcome!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Excel Writing Using Java
 
Similar Threads
opening the excel sheet from servlet
Issue with Download using ZipOutputStream
Excel steps -
Exporting some data to excel
creating enlarged image in excel using java