It might be specific to the type of your OLE object. What exactly did
you copy/paste into your slide?
I did a simple test that passed OK to me:
- create a presentation with a blank slide
- go to Insert / Object and insert PowerPoint Slide
- save
- run your sample code against the created file
- open the result in PowerPoint 2010 and test that the embedded
object is editable
So far all is fine on the POI side.
Can you please run the following code and verify the result:
OPCPackage pkg = OPCPackage.open(args[0]);
pkg.save(new File(args[1]));
pkg.close();
It will test your hypothesis that the OPC package is not properly
constructed when there is an embedded OLE object among package parts.
Yegor
On Tue, Dec 20, 2011 at 11:32 PM, Tony Collins <[email protected]> wrote:
> I'm not sure this is the appropriate forum for this question, but hopefully
> someone here can help me find the appropriate forum.
>
> I need to generate a .pptx file with embedded OLE objects in it. Through
> research and trial and error, I think I managed to figure out how to generate
> the appropriate XML files to do this. The usermodel stuff in xslf doesn't
> support this yet so I had to learn how to do it at a lower level using the
> org.openxmlformats.schemas.presentationml.x2006 and
> org.openxmlformats.schemas.drawingml.x2006.main classes as well as direct
> manipulation of the underlying XML objects provided by XML beans.
>
> The issue I have now doesn't seem to be related to the XML itself though.
> When trying to open the embedded object in the .pptx file, I get the
> following error message:
>
> "The server application, source file, or item can't be found, or returned an
> unknown error. You may need to reinstall the server application."
>
> Note that is is *NOT* due to any misconfiguration of the OLE provider. I
> have a .pptx file that was created by cutting/pasting an OLE object into a
> slide. This .pptx file works fine. My POI-based code generates pretty much
> identical XML (few minor non-functional differences), but my .pptx file does
> not work. I also wrote a simple POI test program that reads in an existing
> .pptx file and just writes it back out to a different file. Using the
> working .pptx as the input, the generated .pptx file from this code also
> exhibits the same behavior (i.e. I can open the .pptx file but trying to open
> or edit the embedded OLE object fails). The code is below:
>
> XMLSlideShow ppt = null;
> try {
> ppt = new XMLSlideShow(new FileInputStream(args[0]));
> } catch (FileNotFoundException e2) {
> // TODO Auto-generated catch block
> } catch (IOException e2) {
> e2.printStackTrace();
> }
> try {
> FileOutputStream out = new FileOutputStream(args[1]);
> ppt.write(out);
> out.close();
> } catch (FileNotFoundException e) {
> e.printStackTrace();
> } catch (IOException e) {
> e.printStackTrace();
> }
>
> Finally, I tried a similar experiment by just copying the working .pptx in
> Windows, unzipping using Windows, and rezipping it. No further changes were
> made to the contained files. Here, the rezipped .pptx file fails with the
> same behavior. So, this doesn't seem to be an issue with the POI code -- it
> seems to be a more fundamental issue with generating the .pptx file from the
> constituent parts.
>
> I'm running PowerPoint 2010 (don't currently have access to an older
> version). The only thing I've found that comes close to describing the same
> type of problem is the following link
> http://social.msdn.microsoft.com/Forums/en-GB/oxmlsdk/thread/957bc111-86c6-4548-9a2e-917051ccb46d.
> This link says that it has something to do with how the embedded
> oleObject1.bin file is zipped and suggests that the problem is a bug in
> PowerPoint 2010. There is no further information so I don't know whether to
> believe this or not or what to do if it is a PowerPoint bug.
>
> So, while this does not appear to be a POI related issue, I was hoping
> someone could point me to a forum or a person who might be able to help me
> track this down. Otherwise, I'm kind of stuck. Anyone else run into similar
> issues? Anyone else suspect that how the file is zipped might affect the
> embedded OLE functionality? Seems dubious to me, but everything else is the
> same between the good and bad .pptx files, so maybe it is how it is zipped.
>
>
> Thanks,
> Tony
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]