Page 1 of 1

Issue with 2010 pptx containing shockwave flash object

PostPosted: Sat Jun 23, 2012 11:41 pm
by sma
I've created a presentation in PowerPoint 2010 containing only one shoackwave flash object. I am trying to create a copy of this presentation using docx4j 2.8.0 API. The code runs successfully, but, when the copy presentation is opened, PowerPoint complains

"PowerPoint found a problem with the content in copy.pptx.
PowerPoint can attempt to repair the presentation."

When I say repair it says "This file cannot be opened by using Microsoft PowerPoint" and the presentation goes blank. This works absolutely fine for PowerPoint 2007. Any suggestions to get this working for 2010? Any help is greatly appreciated.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Sun Jun 24, 2012 8:31 am
by jason
How are you creating the copy?

When you run the original and the copy through PartsList, do they have the same parts?

Could you paste here the XML of the slide containing the flashobject, for the original and the copy?

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Sun Jun 24, 2012 9:12 pm
by sma
Thanks for getting back!
This is the piece of code I am using to create the copy
Code: Select all
String inputfilepath = "/home/sma/powerpoint/2010PPT.pptx";
String outputfilepath ="/home/sma/powerpoint/2010PPT_COPY.pptx";

PresentationMLPackage pmlPackage =(PresentationMLPackage)OpcPackage.load(new java.io.File(inputfilepath));

SaveToZipFile saver = new SaveToZipFile(pmlPackage);
saver.save(outputfilepath);

I've compared the parts and both presentations have 26 parts. Verified the part names, but couldn't find any difference. The XML of the slide in both the presentations are also the same. Copied them below for reference.
Original-XML
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<p:sld xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
   xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
   xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"
   xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram"
   xmlns:ns10="http://schemas.openxmlformats.org/drawingml/2006/compatibility"
   xmlns:ns11="http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"
   xmlns:ns5="http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"
   xmlns:ns9="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
   xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
   xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
   xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
   <p:cSld>
      <p:spTree>
         <p:nvGrpSpPr>
            <p:cNvPr id="1" name="" />
            <p:cNvGrpSpPr />
            <p:nvPr />
         </p:nvGrpSpPr>
         <p:grpSpPr>
            <a:xfrm>
               <a:off x="0" y="0" />
               <a:ext cx="0" cy="0" />
               <a:chOff x="0" y="0" />
               <a:chExt cx="0" cy="0" />
            </a:xfrm>
         </p:grpSpPr>
      </p:spTree>
      <p:controls>
         <p:control imgH="5759280" imgW="7561440" name="ShockwaveFlash1"
            r:id="rId2" />
      </p:controls>
      <p:extLst>
         <p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
            <p14:creationId
               xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"
               val="2204587297" />
         </p:ext>
      </p:extLst>
   </p:cSld>
   <p:clrMapOvr>
      <a:masterClrMapping />
   </p:clrMapOvr>
</p:sld>

Copy-XML
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<p:sld xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
   xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
   xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"
   xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram"
   xmlns:ns10="http://schemas.openxmlformats.org/drawingml/2006/compatibility"
   xmlns:ns11="http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"
   xmlns:ns5="http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"
   xmlns:ns9="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
   xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"
   xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
   xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
   <p:cSld>
      <p:spTree>
         <p:nvGrpSpPr>
            <p:cNvPr id="1" name="" />
            <p:cNvGrpSpPr />
            <p:nvPr />
         </p:nvGrpSpPr>
         <p:grpSpPr>
            <a:xfrm>
               <a:off x="0" y="0" />
               <a:ext cx="0" cy="0" />
               <a:chOff x="0" y="0" />
               <a:chExt cx="0" cy="0" />
            </a:xfrm>
         </p:grpSpPr>
      </p:spTree>
      <p:controls>
         <p:control imgH="5759280" imgW="7561440" name="ShockwaveFlash1"
            r:id="rId2" />
      </p:controls>
      <p:extLst>
         <p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
            <p14:creationId
               xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main"
               val="2204587297" />
         </p:ext>
      </p:extLst>
   </p:cSld>
   <p:clrMapOvr>
      <a:masterClrMapping />
   </p:clrMapOvr>
</p:sld>

Please let me know if attaching both the presentations will be of any help. Many thanks!

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Sun Jun 24, 2012 9:32 pm
by jason
At a glance I'm surprised to see p14:creationId in the copy.

If you could email me the original pptx, I'll take a look. jason@plutext.org

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Tue Jun 26, 2012 12:33 pm
by jason
original slide1.xml contains:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
   <p:controls>
      <mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
        <mc:Choice xmlns:v="urn:schemas-microsoft-com:vml" Requires="v">
          <p:control spid="1026" name="ShockwaveFlash1" r:id="rId2" imgW="7561440" imgH="5759280"/>
        </mc:Choice>
        <mc:Fallback>
          <p:control name="ShockwaveFlash1" r:id="rId2" imgW="7561440" imgH="5759280">
            <p:pic>
              <p:nvPicPr>
                <p:cNvPr id="0" name="ShockwaveFlash1"/>
                <p:cNvPicPr preferRelativeResize="0">
                  <a:picLocks noChangeArrowheads="1" noChangeShapeType="1"/>
                </p:cNvPicPr>
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


docx4j complains:

Code: Select all
WARN org.docx4j.utils.XSLTUtils .logWarn line 16 - Found some mc:AlternateContent
WARN org.docx4j.utils.XSLTUtils .logWarn line 16 - Selecting p:control
WARN org.docx4j.jaxb.JaxbValidationEventHandler .handleEvent line 90 - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/presentationml/2006/main", local:"pic"). Expected elements ar
INFO org.docx4j.jaxb.JaxbValidationEventHandler .handleEvent line 106 - continuing (with possible element/attribute loss)


output slide1.xml:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
    <p:controls>
      <p:control imgH="5759280" imgW="7561440" r:id="rId2" name="ShockwaveFlash1"/>
    </p:controls>
 
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


org.pptx4j.pml.CTControl does not allow for p:pic content, as per the following in pml-embedding.xsd:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
        <xsd:complexType name="CT_Control">
                <xsd:sequence>
                        <xsd:element name="extLst" type="CT_ExtensionList"
                                minOccurs="0" maxOccurs="1" />
                </xsd:sequence>
                <xsd:attributeGroup ref="AG_Ole" />
        </xsd:complexType>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


This is from ECMA-376, first edition (as opposed to 2ed, which was not then available).

In the second edition, the model changed (pml.xsd) to:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
        <xsd:complexType name="CT_Control">
                <xsd:sequence>
                        <xsd:element name="extLst" type="CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
                        <xsd:element name="pic" type="CT_Picture" minOccurs="0" maxOccurs="1"/>
                </xsd:sequence>
                <xsd:attributeGroup ref="AG_Ole"/>
        </xsd:complexType>
 
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


So to fix we need to regenerate the pml classes using the second edition pml.xsd.

Created issue https://github.com/plutext/docx4j/issues/13

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Wed Jun 27, 2012 5:28 pm
by sma
Thanks Jason. I see that the fix is targeted for 2.8.1 release. Do you know of any rough timeline on when this would happen?

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Wed Jun 27, 2012 7:01 pm
by jason
August, unless I get some free time sooner.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Sat Oct 13, 2012 4:19 am
by sma
The issue still exists with the 2.8.1 version also. Looks like it hasn't been addressed. Would like to know if there is any update on when it is likely to be resolved? I am waiting eagerly for it. Any input is greatly appreciated.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Mon Oct 15, 2012 6:15 pm
by jason
Yes, sorry, I overlooked this.

I'll aim to look at it in the first week of November. It wouldn't hurt to remind me on 1 November...

cheers .. Jason

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Fri Nov 02, 2012 10:30 pm
by sma
The reminder that you've asked for! Many thanks in advance.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Sun Nov 04, 2012 11:05 am
by jason
Thanks for the reminder.

Issue 13 now closed.

You can fetch the code from GitHub now, but I will also create a nightly incorporating the changes a bit later today.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Thu Nov 08, 2012 10:10 pm
by sma
Thanks Jason, but, I still can't get it working. When I tried the nightly build "docx4j-nightly-20121104.jar" the code runs successfully but the issue with creating a copy of 2010 presentations still exists.
With the nightly build "docx4j-nightly-MOXy-20121106.jar", the code throws an exception complaining of "java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory" Tried to add a new dependency jar "easybeans-uberjar-eclipselink-1.1.0-M1.jar" but still it was giving a different exception.
Can you please help?

Many thanks
sma

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Thu Nov 08, 2012 10:32 pm
by jason
Please try http://www.docx4java.org/docx4j/docx4j- ... 121108.jar

If that doesn't work, then please attach a 2010 pptx with a flash object added in Powerpoint, and I'll see whether I can round trip it.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Fri Nov 09, 2012 9:35 pm
by sma
Opening the copy is giving the message "Some controls on this presentation can't be activated. They might not be registered on this computer."
I see one warning message on the console
WARN JaxbValidationEventHandler:90 - [ERROR] : unexpected element (uri:"http://schemas.openxmlformats.org/markup-compatibility/2006", local:"AlternateContent"). Expect
INFO JaxbValidationEventHandler:106 - continuing (with possible element/attribute loss)

Attached is the 2010 pptx that I used for testing
2010_PPTX.pptx
2010 pptx with a flash object
(44.17 KiB) Downloaded 332 times
.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Fri Nov 09, 2012 10:50 pm
by jason
slide1.xml contains

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
      xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
      xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
  <p:cSld>
    <p:spTree>
      <p:nvGrpSpPr>
        <p:cNvPr id="1" name=""/>
        <p:cNvGrpSpPr/>
        <p:nvPr/>
      </p:nvGrpSpPr>
      <p:grpSpPr>
        <a:xfrm>
          <a:off x="0" y="0"/>
          <a:ext cx="0" cy="0"/>
          <a:chOff x="0" y="0"/>
          <a:chExt cx="0" cy="0"/>
        </a:xfrm>
      </p:grpSpPr>
    </p:spTree>
    <p:controls>
      <mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
        <mc:Choice xmlns:v="urn:schemas-microsoft-com:vml" Requires="v">
          <p:control spid="1026" name="ShockwaveFlash1" r:id="rId2" imgW="8064360" imgH="5905440"/>
        </mc:Choice>
        <mc:Fallback>
          <p:control name="ShockwaveFlash1" r:id="rId2" imgW="8064360" imgH="5905440">
            <p:pic>
              <p:nvPicPr>
                <p:cNvPr id="0" name="ShockwaveFlash1"/>
                <p:cNvPicPr preferRelativeResize="0">
                  <a:picLocks noChangeArrowheads="1" noChangeShapeType="1"/>
                </p:cNvPicPr>
                <p:nvPr/>
              </p:nvPicPr>
              <p:blipFill>
                <a:blip r:embed="rId4">
                  <a:extLst>
                    <a:ext uri="{28A0092B-C50C-407E-A947-70E740481C1C}">
                      <a14:useLocalDpi xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" val="0"/>
                    </a:ext>
                  </a:extLst>
                </a:blip>
                <a:srcRect/>
                <a:stretch>
                  <a:fillRect/>
                </a:stretch>
              </p:blipFill>
              <p:spPr bwMode="auto">
                <a:xfrm>
                  <a:off x="611188" y="476250"/>
                  <a:ext cx="8064500" cy="5905500"/>
                </a:xfrm>
                <a:prstGeom prst="rect">
                  <a:avLst/>
                </a:prstGeom>
                <a:noFill/>
                <a:ln w="9525">
                  <a:miter lim="800000"/>
                  <a:headEnd/>
                  <a:tailEnd/>
                </a:ln>
                <a:effectLst/>
                <a:extLst>
                  <a:ext uri="{AF507438-7753-43E0-B8FC-AC1667EBCBE1}">
                    <a14:hiddenEffects xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main">
                      <a:effectLst>
                        <a:outerShdw dist="35921" dir="2700000" algn="ctr" rotWithShape="0">
                          <a:schemeClr val="bg2"/>
                        </a:outerShdw>
                      </a:effectLst>
                    </a14:hiddenEffects>
                  </a:ext>
                </a:extLst>
              </p:spPr>
            </p:pic>
          </p:control>
        </mc:Fallback>
      </mc:AlternateContent>
    </p:controls>
    <p:extLst>
      <p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
        <p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="1477661022"/>
      </p:ext>
    </p:extLst>
  </p:cSld>
  <p:clrMapOvr>
    <a:masterClrMapping/>
  </p:clrMapOvr>
</p:sld>
 
Parsed in 0.007 seconds, using GeSHi 1.0.8.4


src/main/java/org/docx4j/jaxb/mc-preprocessor.xslt selects the mc:Fallback content. With this pptx, using this yields the message you saw when I try to open it
in powerpoint 2010. But it works in 2013 preview!

I tried using the mc:choice content; powerpoint 2010 said it "found a problem with content" .... Same problem with the 2013 preview.

So it looks like the mc:AlternateContent mechanism is not working as advertised in Powerpoint 2010, and only partially working in 2013.

I think we might need to seek some input on the MSDN forums.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Tue Nov 20, 2012 12:48 pm
by jason
I have an idea for a workaround for this probable problem with mc:AlternateContent in Powerpoint 2010; give me a few days to try it out.

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Fri Nov 30, 2012 9:28 pm
by sma
That sounds great! Please keep me posted!!

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Tue Dec 11, 2012 10:52 am
by jason
With https://github.com/plutext/docx4j/commi ... 2431d34618 mc:AlternateContent in a pptx slide's p:controls is preserved.

However, Powerpoint still doesn't like round tripped output from flash.pptx!

I have no idea why, having spent an hour or 2 looking at it.

Maybe somebody else can find what Powerpoint is complaining about.

The fact that there is still a problem when the mc:AlternateContent element is preserved, suggests that the actual problem is elsewhere (and therefore that we might not need to preserve it after all).

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Thu Apr 25, 2013 12:41 pm
by jason

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Tue Apr 30, 2013 5:32 am
by sma
I was overjoyed to see an update here! But with the jar "docx4j-nightly-20130425.jar" I can't get it working for either 2007 or 2010. No errors in the process, but powerpoint cannot the open the copy. It is giving the message "Powerpoint was unable to display some of the text, images, or objects on slides in file..., because they have become corrupted." is there anything I am missing?

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Tue Apr 30, 2013 10:02 am
by jason
Since that was a few days ago, I'm not certain whether I made the fix then the jar, or made the jar first (and the fix later in the day), but it is likely the fix is in that jar.

I confirmed the fix by running your pptx 2010_PPTX.pptx through org.pptx4j.samples.RoundTripTest and opening the output in Powerpoint 2010.

Did you do that, or something different?

Re: Issue with 2010 pptx containing shockwave flash object

PostPosted: Tue Apr 30, 2013 7:54 pm
by sma
Many thanks Jason!! It works great with org.pptx4j.samples.RoundTripTest!!!
I was trying to save using the org.docx4j.openpackaging.io.SaveToZipFile and that is failing.
Code: Select all
SaveToZipFile saver = new SaveToZipFile(presentationMLPackage);
saver.save(outputfilepath);

I prefer 'SaveToZipFile' as the save method there can take java.io.OutputStream as its parameter and not restricted just to java.io.File.
Any chance you can update SaveToZipFile or do you recommend using the save on org.docx4j.openpackaging.packages.PresentationMLPackage?