0

I can successfully manipulate fields in the header and footer sections of a DOCX document with TinyButStrong (TBS) through this code:

        $TBS->PlugIn(OPENTBS_SELECT_HEADER); 
        $TBS->MergeField('abk', 'ainfo', true);
        $TBS->PlugIn(OPENTBS_SELECT_FOOTER); 
        $TBS->MergeField('abk', 'ainfo', true);

However, this does not work with an ODT file that is just the DOCX file saved in a different format through LibreOffice.

I found out that I can make it work by manually selecting the enclosed file "style.xml", but this seems not the right way to do it as it does not address a document section in the abstract sense:

        $TBS->PlugIn(OPENTBS_SELECT_FILE, 'styles.xml'); 
        $TBS->MergeField('abk', 'ainfo', true);

Does anybody have a better solution?

1 Answer 1

0

I later found out that a multi-section DOCX document causes a similar problem and only its first section is processed. As Skrol29, the maintainer of openTBS, kindly noted, there is a small bug in version 1.10.0 that prevents proper selection of document parts. As a workaround do this:

$TBS->PlugIn(OPENTBS_SELECT_FILE, 'word/header2.xml', false);
$TBS->MergeField('abk', 'ainfo', true);

Proceed with all the sections (header3, header4...) you have. Note that the footers need extra selection.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.