Categories > [old] TbsOoo & TinyDoc >

how to insert a page break using tbsooo_class

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: sam
Date: 2006-01-19
Time: 08:53

how to insert a page break using tbsooo_class

Hello all ,
i've been trying to get help with the tbsooo_class. I know its an open office class but I dont know where to get help from since I cant seem to contact the author Olivier LOYNET (tbsooo@free.fr) and I dont think there is a forum for this class.
Anyway you guys seem to be very able so could you please spare a minute and give me a hand since it is fairly simple (i think!)

I am querying a mysql db and able to get the records out. I can populate the tbs block OK but  I want each record to occur
*** ON A NEW PAGE ***. At the moment its coming out in the table going down as a list on 1 page.
Could anyone edit the code I've supplied to include the page break (section break?) whatever is needed so that the pref_name and the surname occur at the top of every page. ie if there is 10 records the following code needs to produce a 10page openoffice download.

Here is the OO template that lives on the server. I think the page break needs to go in here somewhere:

+--------------------------------------------------------------------+
+   Num    +  Firstname                             +    Surname     +
+--------------------------------------------------------------------+
+ [blk1.#] + [blk1.pref_name;block=table:table-row] + [blk1.surname] +
+--------------------------------------------------------------------+
+     [blk1;block=table:table-row;nodata]There is no data.           +
+--------------------------------------------------------------------+


Here is the php code to produce the OpenOffice download (OO)

<?php
include_once('../tbs_class.php');
include_once('../tbsooo_class.php');
include_once('../../../common.php');


$result= mysql_query ("SELECT * from 800lines limit 10");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
while($row = mysql_fetch_array($result))
{
    $f[]=array(pref_name=>$row[pref_name],surname=>$row[surname]);
}

// instantiate a TBS OOo class
$OOo = new clsTinyButStrongOOo;

// setting the object
$OOo->SetZipBinary('zip');
$OOo->SetUnzipBinary('unzip');
$OOo->SetProcessDir('tmp/');

// create a new openoffice document from the template with an unique id
$OOo->NewDocFromTpl('sams_try4b.odt');

// merge data with openoffice file named 'content.xml'

$OOo->LoadXmlFromDoc('content.xml');
$OOo->MergeBlock('blk1',$f) ;
$OOo->SaveXmlToDoc();

// display
header('Content-type: '.$OOo->GetMimetypeDoc());
header('Content-Length: '.filesize($OOo->GetPathnameDoc()));
$OOo->FlushDoc();
$OOo->RemoveDoc();
?>

BTW is the way I have made the associative array f$[] the only way to get the fields out of the db?  Cant I get them out straight away since  $row[] is already an associative array? (ie is there the need to create $f[]?)

THanks in advance
sam
By: sam
Date: 2006-01-19
Time: 09:41

Re: how to insert a page break using tbsooo_class

Just found the 'TBS with OpenOffice'.
Sorry, I re-posted to this forum.

thanks
sam