Bug 37622 - Write garbage output when a formula contains Euro symbol.
Summary: Write garbage output when a formula contains Euro symbol.
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-FINAL
Hardware: Other Windows 2000
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-24 09:35 UTC by rndbox
Modified: 2006-01-03 03:39 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rndbox 2005-11-24 09:35:05 UTC
poi-2.0-final-20051122.jar couldn't write Excel output properly when a formula
contains a Euro symbol, e.g, =TEXT('Value is '!H7,"€###,##0")

The output for "€###,##0" will become some garbage, but same length.

If I take out the Euro symbol then everything works fine.

I'm following the Busy Developers' Guide to HSSF:
// Write the output to a file
    FileOutputStream fileOut = new FileOutputStream("workbook.xls");
    wb.write(fileOut);
    fileOut.close();

Note: I have no choice but to use poi 2.0 because all subsequent versions will
cause errors on my workbook (quite complicated), "Unable to read file." and
eventually "Damage to the file was so extensive that repairs were not possible.
 Excel attemted to recover your formulas and values, but some data may have been
lost or corrupted."  -- perhaps I should file another bug report for this later.

If there's no plan to back patch to version 2.0, if anyone know please tell me
where to fix it so that I can do it myself.

Thank you very much.
Comment 1 rndbox 2005-11-24 10:32:24 UTC
Btw, I have also tried:

wb.setSheetName(0, wb.getSheetName(0), HSSFWorkbook.ENCODING_UTF_16)

and

wb.setSheetName(0, wb.getSheetName(0),HSSFWorkbook.ENCODING_COMPRESSED_UNICODE)

and even

(((wb.getSheetAt(0)).getRow(2)).getCell((short)4)).setEncoding(HSSFWorkbook.ENCODING_UTF_16)

and

(((wb.getSheetAt(0)).getRow(2)).getCell((short)4)).setEncoding(HSSFWorkbook.ENCODING_COMPRESSED_UNICODE)

before writing the output, but didn't work.

Even if setting individual cell works, I do not know when the users will type
the Euro symbol, it could exists anywhere in the workbook.
Comment 2 Jason Height 2006-01-03 12:39:27 UTC
Fix applied to SVN. Tested in TestUnicodeWorksheet.

Jason