Categories > OpenTBS with DOCX >

Corrupt output

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Arnold
Date: 2013-12-24
Time: 16:32

Corrupt output

Hello,

i'm merging  templates using tbs 3.8.2 and opentbs 1.8.1

when i'm merging and downloading the document i can open it correct in Open-/Libreoffice
but MS Office 2010 says the files are corrupt. and after some error messages it displays but without (merged)images.
the alt text for the images is "read error".
when opening the docx in archive manager (ubuntu) the images are present inside the document. and as sayd LibreOffice opens them correct.

first i thought it was because i used adjust=100% and the displayd images where bigger than the page. (yet again Libreoffice displayed perfect)
this was not the case, even when using adjust with no parameter Word wouldn't open them.

then i thought it was because the template was made in Libreoffice and the merged file was opend in Word.
but this didn't matter. i created a new template document in Word and tryed to merge but still nothing.

only after removing the image the document was succesfully merged and could be opend in Word.

the images are located on the server as PNG files. yet again the files are perfectly fine, i can open them.

edit: not tested yet but is MS Wowd having problems with space and add characters in the image name?

can you help me?

OUTPUT XML DEBUG:
------------------------------
INFORMATION
------------------------------
* Debug command: OPENTBS_DEBUG_XML_SHOW
* OpenTBS version: 1.8.1
* TinyButStrong version: 3.8.2
* PHP version: 5.5.6-1+debphp.org~precise+2
* Opened document: /tmp/phpFgJIB8
* Activated features for document type: openxml/docx
* Deleted files in the archive: none
* Added files in the archive:
  - word/media/xxxxxxx xxxxxx.png
* Modified files in the archive:
  - word/_rels/document.xml.rels
  - word/document.xml
  - [Content_Types].xml

------------------------------
File merged with OpenTBS (XML reformated for debuging only): word/_rels/document.xml.rels
------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image3.png"/>
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/>
<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
<Relationship Id="opentbs1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/xxxxx xxxxxx.png"/>
</Relationships>
------------------------------
File merged with OpenTBS (XML reformated for debuging only): word/document.xml
By: Skrol29
Date: 2013-12-26
Time: 01:22

Re: Corrupt output

Hi Arnold, happy Christmas,

> edit: not tested yet but is MS Word having problems with space and add characters in the image name?

This has not been tested yet. Can you give an example ?

I need more clue to understand the problem. Can you send a template that can reproduce the problem?

By: Arnold
Date: 2013-12-26
Time: 11:52

Re: Corrupt output

Hi Skrol, marry Christmas too you too.

i've send you an email. (this post is for future reference and other readers with the same problem)

what i meant with the image was, is MS Word having trouble reading "special" characters like - and spaces
or does TBS having trouble implementing them correct.
but then on the other side, LibreOffice is processing them correct.

i've tryed the same template without the image merge and that works fine, MS Word can open it without a hick up.
By: Skrol29
Date: 2013-12-28
Time: 00:39

Re: Corrupt output

Hi Arnold,

Actually the spaces in the name of the images is the problem.

I've taken you merged docx, renamed images file names in "word/media/", then in the file "word/_rels/document.xml.rels" and then the document is opened correctly.
I'll will fix this problem in the next release. For now I suggest that you use parameter "as" in order to change the file name inside the docx.
See: http://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html#pic
By: Arnold
Date: 2013-12-28
Time: 12:02

Re: Corrupt output

Hi Skrol,

sorry for wasting you're time, that was something i could have figured out myself.
but i'm clad i could help make tinybutstrong even better.

so what should be best practice for naming the images? using urlencode()?
any idea on the limitations in MS Word on naming files.
By: Skrol29
Date: 2014-04-03
Time: 01:13

Re: Corrupt output

The internal name of the file must follow the OPC part naming guidelines.
OPC is the common format for Ms Office files.
http://msdn.microsoft.com/en-us/magazine/cc163372.aspx

Nevertheless, I cannot found any naming guidelines actually.
urlencode() or rawurlencode() does not work.
All I can figure out is that accents and spaces are forbidden as is.