You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Burt Leung <bu...@gmail.com> on 2009/04/02 23:50:53 UTC

Using POI with SharePoint document

Hi All,
I want to use POI to programmatically edit an Excel document that is managed
by Microsoft SharePoint. Typically, I use an application which captures some
data and then I manually edit the Excel file to input the values before
committing the changes to SharePoint. I want to automate this data entry
process.

The challenge that I'm facing with using POI right now is opening up the
SharePoint managed Excel file for reading/writing. I tried to use the "save
workspace" option in Excel, which generates a "*.xlw" file (versus the
normal Excel "*.xls" file). This is great if I want to manually reopen the
file later to synchronize changes with SharePoint. However, when I tried to
use POI to open an InputStream, an error occurred.
========
java.io.IOException: Unable to read entire header; 358 bytes read; expected
512 bytes
at
org.apache.poi.poifs.storage.HeaderBlockReader.alertShortRead(HeaderBlockReader.java:130)
at
org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:94)
at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:151)
========

Is there a way that I can accomplish the goal of programmatically editing a
SharePoint managed Excel document? The only other solution I can think of
that would work would be to save a local copy of the Excel file, then use
POI to push the data into it. Then manually open the local copy and do a
copy/paste of the worksheet onto the SharePoint document. I'm not sure this
way would be worth it though.

Thanks,
Burt

Re: Using POI with SharePoint document

Posted by MSB <ma...@tiscali.co.uk>.
As far as I can make out, an xlw file is not an xls file in another guise. It
seems that the Workspace file simply stores information about one of more
workbooks and their state; in order to process the workbooks, you need
access to them also. Speaking from the vantage point of ignorance, I can
only assume that the processing cyle would be reading the xlw file to see
which workbooks should be addressed and then processing them would be the
way to go; how you read the workspace file is, of course, another question
entirely and I do not think that you can use POI to take this first step.


Burt Leung wrote:
> 
> Hi All,
> I want to use POI to programmatically edit an Excel document that is
> managed
> by Microsoft SharePoint. Typically, I use an application which captures
> some
> data and then I manually edit the Excel file to input the values before
> committing the changes to SharePoint. I want to automate this data entry
> process.
> 
> The challenge that I'm facing with using POI right now is opening up the
> SharePoint managed Excel file for reading/writing. I tried to use the
> "save
> workspace" option in Excel, which generates a "*.xlw" file (versus the
> normal Excel "*.xls" file). This is great if I want to manually reopen the
> file later to synchronize changes with SharePoint. However, when I tried
> to
> use POI to open an InputStream, an error occurred.
> ========
> java.io.IOException: Unable to read entire header; 358 bytes read;
> expected
> 512 bytes
> at
> org.apache.poi.poifs.storage.HeaderBlockReader.alertShortRead(HeaderBlockReader.java:130)
> at
> org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:94)
> at
> org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:151)
> ========
> 
> Is there a way that I can accomplish the goal of programmatically editing
> a
> SharePoint managed Excel document? The only other solution I can think of
> that would work would be to save a local copy of the Excel file, then use
> POI to push the data into it. Then manually open the local copy and do a
> copy/paste of the worksheet onto the SharePoint document. I'm not sure
> this
> way would be worth it though.
> 
> Thanks,
> Burt
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-POI-with-SharePoint-document-tp22857756p22870336.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