Bug 36947 - HSSF won't correctly copy/modify a sheet containing comments
Summary: HSSF won't correctly copy/modify a sheet containing comments
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-06 11:02 UTC by Luke Chadwick
Modified: 2008-05-17 06:01 UTC (History)
0 users



Attachments
XLS file causing the problem (139.00 KB, application/vnd.ms-excel)
2005-10-06 11:04 UTC, Luke Chadwick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Chadwick 2005-10-06 11:02:12 UTC
Reading up on the issue suggested that similar bugs have been reported, once a
given spreadsheet is copied and modified, excel returns an error on opening
about the file being too damaged to open. Experimenting with they issue lead me
to the conclusion it was only doing on certain spreadsheets, while others would
work perfectly, specifically once I deleted the 'comments' from the spreadsheet
in question (i'll attach it) it worked correctly.

public void testModify(String filename)
{
   try 
   {
	in = new FileInputStream("exists.xls");
	fs = new POIFSFileSystem(in);
        HSSFWorkbook     wb     = new HSSFWorkbook(fs);
        FileOutputStream stream = new FileOutputStream("exists-copy.xls");
        HSSFSheet        sheet  = wb.getSheetAt(0);
        HSSFRow  row  = sheet.getRow(5);
        HSSFCell cell = row.getCell(( short ) 5);
        cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
        cell.setCellValue(9999);
        wb.write(stream);
        stream.close();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}

Both 2.5.1-final and poi-bin-3.0-alpha1-20050704 appear to have the same problem.
Comment 1 Luke Chadwick 2005-10-06 11:04:48 UTC
Created attachment 16603 [details]
XLS file causing the problem
Comment 2 Yegor Kozlov 2008-05-17 06:01:42 UTC
The problem seems to be fixed in poi-3.1-beta1.

Yegor