You can't go backwards when using SXSSF. Switch to XSSF and see if it works.

Adrian


On 6 March 2014 19:02, Zac Morris <[email protected]> wrote:

> I have an existing .xlsm file that I've created.  It has a single sheet,
> and some macros.
>
> I'm using POI to add additional sheets/rows/cell to the workbook.  That is
> working as intended.
>
> SXSSFWorkbook wb=newSXSSFWorkbook(new
> XSSFWorkbook(OPCPackage.open("file.xlsm")),100);
>
> I add the new sheet, and rows/cols to those sheet just fine.
>
> But then I'd like to add some data to the original sheet that was in the
> original file.
>
> I tried via:
>
> Sheet sheet = wb.getSheetAt(0);
> Row  row = sheet.getRow(1);
>      if (row==null)
> row=sheet.createRow(1);
> Cell cell = row.getCell(1);
>      if (cell == null)
>      cell = row.createCell(1);
>      cell.setCellValue("a test");
>
>
> But I get an error related to "data already written to disk".
>
> Any ideas/pointers?
>
> THANKS!
>
> -Zac Morris
>

Reply via email to