How to generate group ODT document with TBS plugin/php?

332 views Asked by At

I have tbs_plug in for generate ODT document in PHP website. It can generate single document as per requirement but i need Multiple document in single ODT file. I am using different template for each document.

1

There are 1 answers

0
Hiren K On BEST ANSWER

If you want to generate multiple page on single document of ODT using Loop then you need to do following

  1. Open your PHP file where you have array of data for generating multiple page ODT

    // Get all data into array from database

$reponse = $conn->query("SELECT Civilite,Nom,Prenom,Session,DateCertif,Lieu FROM Registration WHERE Etat=1 AND Cours='".$titre."' ")->fetchAll(PDO::FETCH_ASSOC);

// Pass that array to ODT doc template using TBS plugin

$TBS->MergeBlock ( 'req',$reponse);

// Generate Group ODT using ODT template file

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

  1. Now open your ODT template file

set page break at top of first page by using this in open office Insert -> Manual Break -> Page Break

After that now at first line of second page write this code in first data block of TBS

block=tbs:page

in my template here is my code

[req.Civilite;block=tbs:page] [req.Prenom]