Embed file.txt

Oct 19, 2011 at 1:43 PM

I am trying to embed differente file formats inside word.docx.

I made some changes as follows:

1) changed the  public function __construct in Sectin/Object.php

from
$_supportedObjectTypes = array('xls', 'doc', 'ppt');

to
$_supportedObjectTypes = array('xls','xlsx','doc','docx','txt','ppt','pdf');

2) Created a image inside the folder _staticDocParts

_default.png


When I check the created docx file, if I try to open embed files different from xls, doc and ppt, it's open just an image, not the attached file.

Could anybody say if it's possible to correct this bug and where should I change it ?

Nov 2, 2011 at 7:09 PM

I have tested the same with PDF, also only a graphic inside the docx.

Also i looked into the generated code, and modified the code to have the ProgID as requested from PDF, but it doesn't work.

    <w:p>
      <w:r>
        <w:object w:dxaOrig="249" w:dyaOrig="160">
          <v:shape id="0ec79dae83042267d490a60b7451e359" type="#_x0000_t75" style="width:104px;height:67px" o:ole="">
            <v:imagedata r:id="rId7" o:title=""/>
          </v:shape>
          <o:OLEObject Type="Embed" ProgID="AcroExch.Document.7" ShapeID="0ec79dae83042267d490a60b7451e359" DrawAspect="Icon" ObjectID="_1325353441" r:id="rId8"/>
        </w:object>
      </w:r>
    </w:p>

In an word generated DOCX it looks like this:
<w:p w:rsidR="0022211B" w:rsidRDefault="0022211B">
<w:r>
<w:object w:dxaOrig="1531" w:dyaOrig="991">
<v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype>
<v:shape id="_x0000_i1025" type="#_x0000_t75" style="width:76.5pt;height:49.5pt" o:ole="">
<v:imagedata r:id="rId4" o:title=""/>
</v:shape>
<o:OLEObject Type="Embed" ProgID="AcroExch.Document.7" ShapeID="_x0000_i1025" DrawAspect="Icon" ObjectID="_1381766012" r:id="rId5"/>
</w:object>
</w:r>
</w:p>
Maybe this helps...