You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Suladna <su...@yahoo.com> on 2009/04/14 15:56:36 UTC

Bringing updated data from Excel without saving the document

Hi!
 
I'm using the below program to bring the text in cell A1 to Java:
 
XSSFWorkbook wb = new XSSFWorkbook("C:/myDocument.xlsm");
XSSFSheet sheet = wb.getSheet("Sheet1");
Row firstRow = sheet.getRow(0);
System.out.println(firstRow.getCell(0).getRichStringCellValue().getString())
 
It works fine, but when I change the text in A1, my program doesn't notice this until I save the Excel-document. If I re-run the program without saving the Excel document, the old text in A1 appears in my Java console. Is it possible to come around this?
 
/Sul Adna


      

Re: Bringing updated data from Excel without saving the document

Posted by Dave Fisher <da...@jmlafferty.com>.
Hi,

Excel and POI are separate. Your POI-based program simply cannot see  
what is shown in Excel until you save the file and then read it back  
into your POI program.

You describe the expected behavior.

Good luck,
Dave

On Apr 14, 2009, at 6:56 AM, Suladna wrote:

> Hi!
>
> I'm using the below program to bring the text in cell A1 to Java:
>
> XSSFWorkbook wb = new XSSFWorkbook("C:/myDocument.xlsm");
> XSSFSheet sheet = wb.getSheet("Sheet1");
> Row firstRow = sheet.getRow(0);
> System 
> .out.println(firstRow.getCell(0).getRichStringCellValue().getString())
>
> It works fine, but when I change the text in A1, my program doesn't  
> notice this until I save the Excel-document. If I re-run the program  
> without saving the Excel document, the old text in A1 appears in my  
> Java console. Is it possible to come around this?
>
> /Sul Adna
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org