TinyButStrong - the PHP Template Engine
Categories > OpenTBS with ODT >

How to add one "odt" file into another "odt" file? (i use opentbs plugin)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Igor
Date: 2015-10-28
Time: 09:52

How to add one "odt" file into another "odt" file? (i use opentbs plugin)

Hello!
I have "test1.odt" and "test2.odt" files. How to merge them?

My code:
<?php
include_once('./tbs_plugin_opentbs_1.9.4/demo/tbs_class.php');
require_once("./tbs_plugin_opentbs_1.9.4/tbs_plugin_opentbs.php");

// Initialize the TBS instance
$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load the OpenTBS plugin

// Load the template №1
$template = 'test1.odt';
$TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8); // Also merge some [onload] automatic fields (depends of the type of document).

// Load the template №2
$template = 'test2.odt';
$TBS->Plugin(OPENTBS_ADDFILE, $template, false, $DataType=OPENTBS_STRING, $Compress=true); // I want merge: 'test1.odt' + 'test2.odt'

$output_file_name = 'test_union.odt';
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
?>

That code not working!

How to add one "odt" file into another "odt" file?
By: Thy
Date: 2015-10-28
Time: 11:33

Re: How to add one "odt" file into another "odt" file? (i use opentbs plugin)

I have the same need. Hope someone will have a solution
By: Skrol29
Date: 2015-10-28
Time: 11:52

Re: How to add one "odt" file into another "odt" file? (i use opentbs plugin)

Hi,

OpenTBS cannot combine two DOCX or two ODT for now. This is a complicated operation because it implies to retrieve all styles, charts, images, objects (and other internal information) from the document to insert ; and to place them correctly inside the target document.
By: spackmat
Date: 2016-02-05
Time: 12:17

Re: How to add one "odt" file into another "odt" file? (i use opentbs plugin)

Hi, this would be very useful. At least to read a block from another file (e.g. a certain table) and place into the current template (replacing aplaceholder or something).

The usecase would be (in my case) a serial letter with a fixed template, but all get a common settlement table on a last page uploaded by the operator for this particular serial letter issue. I don't want the operator to edit and upload the whole template, since Word destroys the OpenTBS placeholders randomly from time to time (by inserting spaces after the . or some magic invisible stuff).