Thanks, 

I was using a older version, but 2.0RC1 fixed the issue.

-----Original Message-----
From: Danny Mui [mailto:[EMAIL PROTECTED]
Sent: Monday, December 15, 2003 6:13 PM
To: POI Users List
Subject: Re: Strage Error when Writing to a Blank Spreadsheet??


What version of POI are you using?  I think this issue should have been 
addressed as of 2.0RC1

Jean, Victor [IT] wrote:
> I'm using POI to write rows/cells to a existing xls file
> that is completely empty.  I generated the empty spreadsheet
> by creating a new excel file and saving the file.
> 
> When I run my POI code, it fails to insert any data.
> However, when I try the same code with existing xls file that 
> has data, it inserts the data correctly.
> 
> Is this a bug?  Attached is the blank spreadsheet i'm working with.
> 
>       
>                 HSSF             hssf   = new HSSF("c:/blank.xls");
> 
>                 HSSFWorkbook     wb     = hssf.hssfworkbook;
>                 FileOutputStream stream = new
> FileOutputStream("c:/output.xls");
>                 HSSFSheet        sheet  = wb.getSheetAt(0);
>                 
>                 HSSFRow  currRow  = sheet.getRow(0);
>                               
>                               //If current row is null in the
spreadsheet
> create a new row 
>                               
>                               if (currRow == null) {
>                                       currRow = sheet.createRow(0);
>                                       System.out.println("Creating new
> row");
>                               }
>                               
>                               HSSFCell c = currRow.getCell((short)0);
>                               if (c == null) {
>                                       HSSFCell newcell =
> currRow.createCell((short)0);
>                               newcell.setCellValue("test");
>                               System.out.println("Creating new cell
for
> row");
>                               }
>                               else {
>                                       c.setCellValue("test");
>                               }
> 
>                 wb.write(stream);
>                 stream.close();
> 
> 
> 
> 
> 
> 
> 
>
------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to