Here I'll show you an simple example how to configure, how to use the columnset and write it as
PDF file.
The PHP script
<?php
/*
* Column test
* $Header: d:/cvs/classistd/sptpl/test/test18.php,v 2.2 2004/02/10 22:08:46 Administrator Exp $
*/
function foo()
{
return("text from foo");
}
function foop($text)
{
return("my parameter:".$text);
}
require_once('../sptpl.php');
require_once('../sptpl.inc');
require_once('../sptpl_db.php');
set_time_limit(0);
$t=new sptpl();
$t->LoadTemplate('test21.xml');
$t->SetVar("name","George");
$t->SetVar("MyName","Sam");
$bar['foo']='Index foo';
$t->SetVar("bar",$bar);
// $t->_DumpInternals();
// die;
$t->run("test21.pdf");
?>
|
Second step, write the configuration file test21.xml
<?xml version='1.0' ?>
<template>
<pagemanager>CPagePdf</pagemanager>
<font id='text' face='Helvetica.afm' size='12'/>
<constant name='const1' value = '1'/>
<constant name='const2' value = '2'/>
<field name='fld1'>
<sourcefield>fld1</sourcefield>
<stringformat>none</stringformat>
<dateformat>none</dateformat>
<value>13</value>
</field>
<report>
<beginreport>
Hi
My First Test
</beginreport>
<OpenPage>
Column test 1
</OpenPage>
<row id='pippo'>
Some text without set the column
</row>
<columnset id='test1'>
<column leftpos='60' Width='100' align='right' />
<column leftpos='170' Width='100' align='center' />
<column leftpos='280' Width='100' align='left' />
</columnset>
<row columnset='test1' column='1' fontid='text'>Text on the first column
</row>
<row column='2' fontid='text'>Text on the second column
</row>
<row column='3' fontid='text'>Text on the third column
</row>
<row column='1' fontid='text'>Align: right
</row>
<row column='2' fontid='text'>Align: center
</row>
<row column='3' fontid='text'>Align: left
</row>
<newpage/>
<row fontid='text'>Another page</row>
<row vpos='absolute' rowpos='50'/>
<row fontid='text'>Another text</row>
<closepage>
Page end - {$PageNumber}
</closepage>
<closereport>
End!That's all folk!
</closereport>
</report>
</template>
|
And here you may see the output