Skrol29 / opentbs

With OpenTBS you can merge OpenOffice - LibreOffice and Ms Office documents with PHP using the TinyButStrong template engine. Simple use OpenOffice - LibreOffice or Ms Office to edit your templates : DOCX, XLSX, PPTX, ODT, OSD, ODP and other formats. That is the Natural Template philosophy.
http://www.tinybutstrong.com/opentbs.php
70 stars 17 forks source link

changepic of block of images #35

Open marcusvinicus opened 6 months ago

marcusvinicus commented 6 months ago

Hi im trying to use a array of images like in the demo example, but i.m having some problems. I´m using the same code of the demo but i cant change the alt text of image that just stop work. I going explain what is going on below:

when i use the exactily image of docx, without change any thing in the image alt text, its work properly , but If change anything in alttext of the image, dont work anymore, even if in the end, the content of the alt text of the image is the same. its happens because when anyone save the document, the document.xml of the docx changes. So i did a diff with the document.xml of the docx documents, with exactly the same content and in result is show below:

image the red is of the original docx, with the original image of the demo example the green is of the saved docx, with the same content in alt text of the image, but i saved as a new docx file

to discover where is the problem i resolve to modifie the document.xml and recover docx document to make a merge thats workout. And i realized that when a leave only one "descr" attribute in document.xml reference the image that will iterate in array it workout.

Could be in first time that descr attribute appear in document.xml or second, both works since i leave only one reference.

Example: Works: image

works: image

dont work image

I have no ideia how can i solve this problem! cause i need to leave docx model free for changes.

Skrol29 commented 6 months ago

Hi @marcusvinicus ,

The behavior is that Ms Word (and Excel, and PowerPoint) add duplicated information when saving the document, in order to enforce compatibility with other versions. In your case, the descr attribute of the <wp:docPr> is duplicated into a <pic:cNvPr>.

But OpenTBS should deal with that. (The problem is detailed in the source code, closed to the keyword pic:cNvPr)

Do you have the last version of OpenTBS ? Does is work if you take off the adjust parameter ?