| 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?
|
 |
 |
|
|
subject: Write character to excel using POI
|
|
|