You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Quan Nguyen Hai <qu...@webreloaded.com> on 2005/07/12 17:55:58 UTC

writing complex Excel file doesn't work

Hi all,
I'm not sure if it is the right place to ask the question. However, I hope that I can understand more about POI mecanism here.
I tried to make some change in a complex Excel file, whith contain macro and formula
, and then rewrite the workbook to the file.
However, when I open the file with Microsoft Excel (XP), I got the list of the repaired errors. However, the file din't run correctly. Here are the message:

---------------------------------
Microsoft Office Excel File Repair Log

Errors were detected in file 'D:\qtsplus-xcel\Multiple\M_M_c_K.xls'
The following is a list of repairs:

Removed one or more invalid formulas.
---------------------------------------------------------

Then, I just open the file, and rewrite it like the following code, I had the same kind of error.
Can you please show me what is the problem and how to fix it ? 

Thank you very much.

Best regards.

Quan.

Some other warnings I get when I opened the file
-----------------------------------------------------
[WARNING] Unknown Ptg 1c (28)

[WARNING] Unknown Ptg 1c (28)

[WARNING] Unknown Ptg 1c (28)

---------------------------------------------------------

-------------My simple code to read and write to the same Excel file----------------------------------


POIFSFileSystem fs = new POIFSFileSystem( 
new FileInputStream(filename));
HSSFWorkbook wb = new HSSFWorkbook(fs); 
HSSFSheet sheet = wb.getSheetAt(0);

//write the workbook to file
FileOutputStream fileOut = new FileOutputStream(filename);
wb.write(fileOut);
fileOut.close();