aspose 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Excel Writing Using Java" Watch "Excel Writing Using Java" New topic
Author

Excel Writing Using Java

A.S. HariLal
Ranch Hand

Joined: Oct 24, 2007
Posts: 31
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: 12781
    
    5
headerCell.setCellValue(new HSSFRichTextString(titleArray.get(cnt))); // Exception is happening here


What is the type of titleArray?
A.S. HariLal
Ranch Hand

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

Joined: Jun 24, 2003
Posts: 3274
    
    5

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
Ranch Hand

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

Joined: Jun 24, 2003
Posts: 3274
    
    5

You're welcome!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Excel Writing Using Java