$table->setnewpagefunction(newpage);
/* Define the columns; note that all the columns have "*"
   as their width which means that the whole table width
   will be divided up and assigned equally to the columns */
$col1 =& $table->addcolumn("", "*", false, $content);
$col2 =& $table->addcolumn("", "*", false, $content);
$col3 =& $table->addcolumn("", "*", false, $content);
$col4 =& $table->addcolumn("", "*", false, $content);
/* Adjust some table parameters */
$table->settopborderwidth(0);
$table->setbottomborderwidth(0);
$table->setcolspacingwidth(50);
$table->setcolspacingcolor(false);
$table->setrowspacingwidth(10);
$table->setrowspacingcolor(false);
$table->setbgcolors(array(false));
/* Fill up the table cell by cell from the left to the right
   by calling the addcell() method

   The table is entirely made up out of containers, so that each
   cell can contain more than one object (2 text objects and
   1 barcode object in this case)

   Note that the containers consist of 3 objects but only 2
   pieces of data are passed via the array; in this case the
   last element of the array is used for the remaining objects */
$table->addcell(array("Monday", "1111"));
$table->addcell(array("Tuesday", "2222"));
$table->addcell(array("Wednesday", "3333"));
$table->addcell(array("Thursday", "4444"));
$table->addcell(array("Friday", "5555"));
Esempio n. 2
0
   tells the class to use the remaining width for this column;
   the addcolumn() method returns a handle so you can adjust
   the column's parameters */
$col1 =& $table->addcolumn("License", "*", &$col1h, &$col1r);
$col2 =& $table->addcolumn("Branches", 100, &$col2h, &$col2r);
$col3 =& $table->addcolumn("Percentage", 100, &$col3h, &$col3r);
$col4 =& $table->addcolumn("Barcode", 100, &$col4h, &$col4r);
/* Adjust some table parameters */
$table->setverttableborderwidth(1);
$table->setverttablebordercolor(0);
$table->setcolspacingwidth(1);
$table->setcolspacingcolor(0);
$table->setrowspacingwidth(1);
$table->setrowspacingcolor(0);
$table->setheaderbgcolor(0.85);
$table->setbgcolors(array(false, 0.95));
/* Adjust the bgcolor of the barcode cell to to white, because
   some barcode readers might get into trouble otherweise */
$col4->normcellparam->bgcolor = 1;
/* Adjust the cell padding on the left and the right side of
   the barcode column, so that the table lines don't interfere
   with the barcode */
$col4->normcellparam->leftpadding = 10;
$col4->normcellparam->rightpadding = 10;
/* Loop through the elements of the example table */
foreach ($exampletable as $data) {
    $table->addrow($data);
}
/* Close the table (important!) */
$table->endtable();
/* Close the last page */