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/05/05 09:43:32 UTC

Creating XSSFWorkbook object using InputStream

Hi!
 
Is there any workaround that enables me to create an XSSFWorkbook using an InputStream?
 
The reason I wonder is because I have want to bring updated data from my Excel 2007 workbook without first having to save it. When I asked about this on a Java-forum I heard that it was possible to do using InputStream (see reply #9 to my question in the below link)
 
http://forums.sun.com/thread.jspa?threadID=5381447
 
Best regards,
Sul


      

Re: Creating XSSFWorkbook object using InputStream

Posted by MSB <ma...@tiscali.co.uk>.
Can I be clear about what you are trying to do please? Are you saying that
you have a workbook open in Excel 2007 and that without saving the file you
have made you want to transport the changes you have made - and only the
changes - into some other application?

If that is indeed the case, then I cannot see how you would be able to do
this without resorting to an Excel macro. If you think about the major
problem for a minute, until you save the Excel file away somewhere there is
no way to connect any sort of stream to the data. Further, how would the
stream 'know' what information to copy? An Excel macro on the other hand
does have access to the internal state of the application. It could - at
least I think it could - recognise the changes you have made and it could -
again I think this is the case - be tasked to save them away to file. But
again, the details could get messy - what should it do with non-contiguous
cells? Should it preserve the locations of the cells as this could mean a
very sparsely populated sheet (obviously, I do not now exactly what your
sheets look like so am guessing here).

If instead you are asking is there a constructor for the XSSFWorkbook class
that accepts an InputStream as a parameter, then the answer is yes. The
stream must however be connected to an OpenXML file somewhere.


Suladna wrote:
> 
> Hi!
>  
> Is there any workaround that enables me to create an XSSFWorkbook using an
> InputStream?
>  
> The reason I wonder is because I have want to bring updated data from my
> Excel 2007 workbook without first having to save it. When I asked
> about this on a Java-forum I heard that it was possible to do using
> InputStream (see reply #9 to my question in the below link)
>  
> http://forums.sun.com/thread.jspa?threadID=5381447
>  
> Best regards,
> Sul
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Creating-XSSFWorkbook-object-using-InputStream-tp23382602p23384995.html
Sent from the POI - User mailing list archive at Nabble.com.


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


Re: Creating XSSFWorkbook object using InputStream

Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 5 May 2009, Suladna wrote:
> Is there any workaround that enables me to create an XSSFWorkbook using 
> an InputStream?

http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/WorkbookFactory.html
http://poi.apache.org/apidocs/org/apache/poi/openxml4j/opc/OPCPackage.html#open(java.io.InputStream)

Nick

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