You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by jo...@muehlencord.de on 2008/05/14 18:39:14 UTC
Update OLE Objects in SlideShow
Hi there,
I used the code from http://poi.apache.org/hslf/how-to-shapes.html#OLE to
get access to an hssfworkbook embedeeded in to a slideshow. This workbook
contains two slides, a datatable and a diagramm. I have updated the diagram
using the HSSF features of POI 3.1_beta. But now i need to write back the
made changes. Since the code from the webpage contains
HSSFWorkbook wb = new HSSFWorkbook(data.getData());
and all changes were applied to wb, I have a copy of the workbook - so I
somehow need to convert this workbook back into the OLEShape or ObjectData
or whatever but I do not know how.
Can some explain it to me?
Thank you!
Kind regards
Joern
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Update OLE Objects in SlideShow
Posted by Yegor Kozlov <ye...@dinom.ru>.
Embedded OLE objects are read-only for now. I researched the topic a
little bit and it happened that saving modified ole data
back in ppt is not trivial.
- embedded OLE objects contain special streams (CompObj and
Ole) which seem to need updating. I didn't figure out yet how do
that.
- The picture you see in PowerPoint is a snapshot of the OLE object in
WMF format. Even if you modify the data, the snapshot will be old.
I don't know a way to re-generate WMF.
For user convenience I added a set accessor for the ole
data. If someone wants to play with it and figure out how embedded OLE
objects are saved, patches are welcome :)
The following code should work and save the modified hssfworkbook back
in ppt:
ObjectData data = ole.getObjectData();
HSSFWorkbook wb = new HSSFWorkbook(data.getData());
//modify
HSSFCell cell = wb.getSheetAt(0).getRow(0).getCell((short)0);
cell.setCellValue(new HSSFRichTextString("Modified by HSLF"));
//saved the modified workbook in memory
ByteArrayOutputStream out = new ByteArrayOutputStream();
wb.write(out);
//save back in ObjectData
data.setData(out.toByteArray());
Regards,
Yegor
> Hi there,
> I used the code from
> http://poi.apache.org/hslf/how-to-shapes.html#OLE to
> get access to an hssfworkbook embedeeded in to a slideshow. This workbook
> contains two slides, a datatable and a diagramm. I have updated the diagram
> using the HSSF features of POI 3.1_beta. But now i need to write back the
> made changes. Since the code from the webpage contains
> HSSFWorkbook wb = new HSSFWorkbook(data.getData());
> and all changes were applied to wb, I have a copy of the workbook - so I
> somehow need to convert this workbook back into the OLEShape or ObjectData
> or whatever but I do not know how.
> Can some explain it to me?
> Thank you!
> Kind regards
> Joern
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org