aspose file tools*
The moose likes Other Open Source Projects and the fly likes Write character to excel using POI 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 "Write character to excel using POI" Watch "Write character to excel using POI" New topic
Author

Write character to excel using POI

Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 125
I have hex code of a special character.

Say, String str="2122";

I want to write the character corresponding to this hex code to an excel file (using POI).

This is my code



Problem is that in the console I am getting the correct character. But when it is written to the excel sheet, i get the corresponding decimal value (rather than the charcter). So the value that i get in the excel sheet is 8482.
Please tell me how can I get the character in the excel sheet.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1815
According to the javadoc,
there isn't a setValue method that takes a char as a parameter, so it must be being converted to a double and calling that method.

What happens if you say:



or, since the setValue(String) is deprecated,



Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 125
Originally posted by Joel McNary:
According to the javadoc,
there isn't a setValue method that takes a char as a parameter, so it must be being converted to a double and calling that method.

What happens if you say:



or, since the setValue(String) is deprecated,



If I do this

cell.setCellValue(new HSSFRichTextString(String.valueOf(c)));

this is the error I get

The method setCellValue(double) in the type HSSFCell is not applicable for the arguments (HSSFRichTextString)
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1815
Try the first one, with the argument as a String. Does that produce a similar error?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Write character to excel using POI
 
Similar Threads
apache pio?
Creating Exel File, streamming
Set character formatting in Excel using POI
How to connect to Open Office Database using JDBC connection in Java
streaming excel files on ServletOutputStream