Categories > OpenTBS with DOCX >

Docx corrupted when multiple image records in table rows

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Alex
Date: 2015-02-11
Time: 09:26

Docx corrupted when multiple image records in table rows

Hi,
I'm trying to fill up my table rows with images, referenced by this code
[a.idimpianto;block=tbs:row;ope=changepic;from=templates/fotoimpianti/[val].jpeg;tagpos=inside;adjust;unique]

The problem is this: if I have more than one record, the docx will be unreadable...
This is the debug information for just one record (docx is ok)
* OPENTBS DEBUG MODE: if the star, (*) on the left before the word OPENTBS, is not the very first character of this page, then your
merged Document will be corrupted when you use the OPENTBS_DOWNLOAD option. If there is a PHP error message, then you have to fix it.
If they are blank spaces, line beaks, or other unexpected characters, then you have to check your code in order to avoid them.

------------------------------
INFORMATION
------------------------------
* Debug command: OPENTBS_DEBUG_XML_CURRENT
* OpenTBS version: 1.9.3
* TinyButStrong version: 3.9.0
* PHP version: 5.5.9-1ubuntu4.5YES
* Opened document: templates/preventivo_RT.docx
* Activated features for document type: openxml/docx
* Deleted files in the archive: none
* Added files in the archive:
  - word/media/opentbs_added_1.jpeg
* Modified files in the archive:
  - word/media/image1.jpeg
  - word/document.xml

------------------------------
File merged with OpenTBS (XML reformated for debuging only): word/document.xml
------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xml:space="preserve">
<w:body>
  <w:tbl>
   <w:tblPr>
    <w:tblW w:w="0" w:type="auto"/>
    <w:tblBorders>
     <w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/>
    </w:tblBorders>
    <w:tblLook w:val="01E0"/>
   </w:tblPr>
   <w:tblGrid>
    <w:gridCol w:w="9778"/>
   </w:tblGrid>
   <w:tr w:rsidTr="002D4542">
    <w:tc>
     <w:tcPr>
      <w:tcW w:w="9778" w:type="dxa"/>
     </w:tcPr>
     <w:p w:rsidRDefault="001B67B4">
      <w:r>
       <w:rPr>
        <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
        <w:sz w:val="12"/>
        <w:szCs w:val="12"/>
       </w:rPr>
       <w:pict>
        <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" alt="" style="width:240.00pt;height:240pt">
         <v:imagedata r:id="opentbs1" o:title=""/>
        </v:shape>
       </w:pict>
      </w:r>
     </w:p>
    </w:tc>
   </w:tr>
  </w:tbl>
  <w:p w:rsidRDefault="001B67B4"/>
  <w:sectPr w:rsidSect="00A90BB1">
   <w:pgSz w:w="11906" w:h="16838"/>
   <w:pgMar w:top="1417" w:right="1134" w:bottom="1134" w:left="1134" w:header="708" w:footer="708" w:gutter="0"/>
   <w:cols w:space="708"/>
   <w:docGrid w:linePitch="360"/>
  </w:sectPr>
</w:body>
</w:document>

and this is the debug for corrupted file:
* OPENTBS DEBUG MODE: if the star, (*) on the left before the word OPENTBS, is not the very first character of this page, then your
merged Document will be corrupted when you use the OPENTBS_DOWNLOAD option. If there is a PHP error message, then you have to fix it.
If they are blank spaces, line beaks, or other unexpected characters, then you have to check your code in order to avoid them.

------------------------------
INFORMATION
------------------------------
* Debug command: OPENTBS_DEBUG_XML_CURRENT
* OpenTBS version: 1.9.3
* TinyButStrong version: 3.9.0
* PHP version: 5.5.9-1ubuntu4.5YES
* Opened document: templates/preventivo_RT.docx
* Activated features for document type: openxml/docx
* Deleted files in the archive: none
* Added files in the archive:
  - word/media/opentbs_added_1.jpeg
  - word/media/opentbs_added_2.jpeg
* Modified files in the archive:
  - word/media/image1.jpeg
  - word/document.xml

------------------------------
File merged with OpenTBS (XML reformated for debuging only): word/document.xml
------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xml:space="preserve">
<w:body>
  <w:tbl>
   <w:tblPr>
    <w:tblW w:w="0" w:type="auto"/>
    <w:tblBorders>
     <w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/>
     <w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/>
    </w:tblBorders>
    <w:tblLook w:val="01E0"/>
   </w:tblPr>
   <w:tblGrid>
    <w:gridCol w:w="9778"/>
   </w:tblGrid>
   <w:tr w:rsidTr="002D4542">
    <w:tc>
     <w:tcPr>
      <w:tcW w:w="9778" w:type="dxa"/>
     </w:tcPr>
     <w:p w:rsidRDefault="001B67B4">
      <w:r>
       <w:rPr>
        <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
        <w:sz w:val="12"/>
        <w:szCs w:val="12"/>
       </w:rPr>
       <w:pict>
        <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" alt="" style="width:240.00pt;height:240pt">
         <v:imagedata r:id="opentbs1" o:title=""/>
        </v:shape>
       </w:pict>
      </w:r>
     </w:p>
    </w:tc>
   </w:tr>
   <w:tr w:rsidTr="002D4542">
    <w:tc>
     <w:tcPr>
      <w:tcW w:w="9778" w:type="dxa"/>
     </w:tcPr>
     <w:p w:rsidRDefault="001B67B4">
      <w:r>
       <w:rPr>
        <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/>
        <w:sz w:val="12"/>
        <w:szCs w:val="12"/>
       </w:rPr>
       <w:pict>
        <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" alt="" style="width:240.00pt;height:240pt">
         <v:imagedata r:id="rIdopentbs2:title=""/>
        </v:shape>
       </w:pict>
      </w:r>
     </w:p>
    </w:tc>
   </w:tr>
  </w:tbl>
  <w:p w:rsidRDefault="001B67B4"/>
  <w:sectPr w:rsidSect="00A90BB1">
   <w:pgSz w:w="11906" w:h="16838"/>
   <w:pgMar w:top="1417" w:right="1134" w:bottom="1134" w:left="1134" w:header="708" w:footer="708" w:gutter="0"/>
   <w:cols w:space="708"/>
   <w:docGrid w:linePitch="360"/>
  </w:sectPr>
</w:body>
</w:document>

I don't know what to check..Could anyone set me to the right path?

Thank you,
Alex
By: Skrol29
Date: 2015-02-11
Time: 16:38

Re: Docx corrupted when multiple image records in table rows

Hi,

This is a bug which is fixed with the fresh new OpenTBS version 1.9.4
Available here for now :
  http://www.phpclasses.org/package/5797-OpenTBS

Will be available on TBS site very soon.