Open nioate opened 3 years ago
Have you tried using tbs:page
?
No, I didn't know that. I suppose I would need then "[tab.name; block=tbs:page]" as table name. However, this is not possible, because LibreOffice does not accept brackets in the table name.
The good place for help and support is https://stackoverflow.com/ using the tag TinyButStrong and OpenTbs.
It is possible to repeat sheets in an ODS file because they are all defined in the same sub-file which is the main file.
Example :
In the ODS template: Choose a sheet in your template, name the sheet « MySheetName » (sheet names cannot have brackets like [ and ]) and put the following fields in a cell : [b;block=table:table], or [b;block=tbs:table].
At the PHP side:
// Include classes
include_once('tbs_class.php'); // Load the TinyButStrong template engine
include_once('tbs_plugin_opentbs.php'); // Load the OpenTBS plugin
// Initialize the TBS instance
$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load the OpenTBS plugin
//load template
$template = 'test.ods';
$TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8);
// sheets to repeat
$data = array(
array('title' => "my sheet 1"),
array('title' => "my sheet 2"),
array('title' => "my sheet 3"),
);
// rename the tbs fields for the sheet name
$TBS->Source = str_replace('{MySheetName}', '[b.title]', $TBS->Source);
// merge sheets
$TBS->MergeBlock('b', $data);
// Finalize the merging
$output_file_name = 'resultat.ods';
$TBS->Show(OPENTBS_FILE, $output_file_name); // Also merges all [onshow] automatic fields.
I am not sure if this is the right place to ask, but I could not find another possibility:
I would like to repeat sheets in an ODS file instead of repeating rows in a sheet or cells in a row. However it seems block=tbs:sheet does not exist. And even if something like that is possible, LibreOffice does not allow sheet names including [ ] brackets.
Any way to solve this?