poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Danny Mui <da...@muibros.com>
Subject Re: Updating Excel Spreadsheet in Shared Worksheet mode
Date Mon, 10 May 2004 15:04:26 GMT
curious set up u got going on there ;)

if the person in the excel client closes/reopens the spreadsheet, do 
they see the reflected automatic changes?

Trying to gauge if HSSF writes any of the special records or that it is 
a reloading issue.

Cook, Doug (STP) wrote:

> I'm trying to programmatically update an Excel spreadsheet that is in shared mode. (Tools->SharedWorksheet...
Allow Changes by more than one user at a time=On). It's a status worksheet that several team
members update and observe status with. I'd like to contribute data programmatically. The
spreadsheet itself is very simple. Doesn't even contain formulas, just string data (and a
little formatting, some background color).
> 
> The program I've written is simple, it follows the example almost exactly
> 
> 	open a file, open a sheet, get a row, get a cell, based on the value of that cell, calculate
the value for another cell, write that cell, close the sheet
> 
> 	POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(statusSpreadsheet));
> 	HSSFWorkbook wb = new HSSFWorkbook(fs);
> 	HSSFSheet sheet = wb.getSheetAt(0);
> 	HSSFRow row = sheet.getRow((short)i);
> 	HSSFCell cell = row.getCell((short) 0);
> 	String build_unit = cell.getStringCellValue() ;
> 	HSSFCell outcell = row.getCell((short) 1);
> 	outcell.setCellValue(resultVersion);
> 	FileOutputStream fileOut = new FileOutputStream(statusSpreadsheet);
> 	wb.write(fileOut);
> 	fileOut.close();
> 
> When I run the program on the file and no other users have the spreadsheet open, the
cells are updated correctly. However, if I have the spreadsheet open in Excel at the same
time, no updates occur. Normally (non-programmatically, both users using Excel) in shared
mode if another user has it open they would see my updates without having to close and re-open
the spreadsheet.
> 
> Can this work with POI, should I be doing something differently?
> 
> I'd like the other users to see the updates automagically.
> 
> Thanks,
> 
> Doug Cook
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org

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


Mime
View raw message