Re: Saving modified Workbook in place

2017-02-01 Thread Nick Burch

On Wed, 1 Feb 2017, Murphy, Mark wrote:
I thought that there was a way to save a workbook in place when using a 
File type input. But I can't find the secret sauce.


The method will be write() with no arguments:
https://poi.apache.org/apidocs/org/apache/poi/POIDocument.html#write()

Off the top of my head, I can't remember how much more work there is to do 
to finish the HSSF support for it...


Nick

-
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org



Re: Saving modified Workbook in place

2017-02-01 Thread Javen O'Neal
https://bz.apache.org/bugzilla/show_bug.cgi?id=57919

This bug is still open as it hasn't been fully implemented for all
constructors and factories yet.

On Feb 1, 2017 06:50, "Murphy, Mark"  wrote:

> I thought that there was a way to save a workbook in place when using a
> File type input. But I can't find the secret sauce. If I open a Workbook
> using WorkbookFactory(new File(filename)); I cannot write to an output
> stream based on the same file name. If I write the modified workbook to an
> output stream based on a different file name, the original file is updated,
> but now I have a second file. If I do not write the changes, but instead
> just close the workbook, it does not create the second file, but it also
> does not update the existing file.
>
> So how can I update an existing spreadsheet without creating a secondary
> file? I am guessing that if I use an InputStream to open the initial file,
> I can write the updated workbook to an OutputStream without the original
> being updated?
>