opentbs error in docx file

My .docx file created with opentbs is unreadable. It contains the tags that causes the error. When I delete them the file is ok

I added this code to force the removal of tags but they are still in my file

$bookmark = array('w:bookmarkStart', 'w:bookmarkEnd');

$TBS->PlugIn(OPENTBS_SELECT_FILE, 'word/document.xml'); $TBS->PlugIn(OPENTBS_DELETE_ELEMENTS, $bookmark); $TBS->Show(OPENTBS_DOWNLOAD,'balise_'.$this->oGest_balise->numero_implantation_balise.'.docx');

Are the bookmark tags added by OPENTBS-DOWNLOAD ? How to avoid it?

Thank you for your propositions

Upvotes: 0

Views: 330

Answers (1)

Skrol29
Skrol29

Reputation: 5597

Elements <w:bookmarkStart> and <w:bookmarkEnd> are Ms Word XML elements that can be inserted manually or automatically by the Ms Word software. (they are not added by OpenTBS)

Those two XML elements are not necessary hierarchically positioned int the XML content, so that why it can be overlapping a TBS block and thus creating an invalid XML Ms Word content after an OpenTBS merge.

You can manage Ms Word bookmarks using a the dialog box via the ribbon : Insert / Bookmark. Automatic bookmarks are hidden bookmarks, but you can manage them in this window.

Automatic bookmarks can be used by Ms Word for Summaries, but if you have no need of Ms Word bookmarks in your template, deleting all bookmarks (as your snipped does) is a clean preventive action in my option.

A small comment about your snippet:

$TBS->PlugIn(OPENTBS_SELECT_FILE, 'word/document.xml'); 

Can be replaced with:

$TBS->PlugIn(OPENTBS_SELECT_MAIN);

Upvotes: 0

Related Questions