You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Martin Studer <ma...@mirai-solutions.com> on 2011/05/16 17:02:12 UTC
Problems with Workbook.write
Hi,
when using Workbook.write (org.apache.poi.ss.usermodel.Workbook) in
succession, the result will be a corrupted, non-readable file. Is this for
some reason intended behavior or is this a bug? There seems to be some state
managed on the workbook level when calling Workbook.write:
File f = new File("C:/temp/test.xlsx");
Workbook wb = new XSSFWorkbook();
Sheet s = wb.createSheet("MySheet");
FileOutputStream fos1 = new FileOutputStream(f, false);
wb.write(fos1);
fos1.close();
FileOutputStream fos2 = new FileOutputStream(f, false);
wb.write(fos2);
fos2.close();
If someone could shed some light on this that would be great.
Thanks,
Martin
Re: Problems with Workbook.write
Posted by Nick Burch <ni...@alfresco.com>.
On Mon, 16 May 2011, Martin Studer wrote:
> when using Workbook.write (org.apache.poi.ss.usermodel.Workbook) in
> succession, the result will be a corrupted, non-readable file. Is this
> for some reason intended behavior or is this a bug? There seems to be
> some state managed on the workbook level when calling Workbook.write:
There are a couple of open bugs on this, but thus far no-one has been able
to track down exactly what's going wrong. If you're able to do some
investigating, that'd be great. Otherwise, if you need to write to several
files, just write into a byte array output stream, and the put the same
bytes in each file
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org