Viewing file: merged_cells.php (1.07 KB) -rwxrwxrwx Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
// register PHPRtfLite class loader
require '../lib/PHPRtfLite.php';
PHPRtfLite::registerAutoloader();
$rtf = new PHPRtfLite();
$sect = $rtf->addSection();
$table = $sect->addTable();
$table->addRows(5, 0.75);
$table->addColumnsList(array(3, 3, 3, 3, 3));
$table->mergeCellRange(1, 1, 3, 1);
$table->writeToCell(1, 1, 'Vertical merged cells.', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat());
$border = PHPRtfLite_Border::create(1, '#ff0000');
$table->setBorderForCellRange($border, 1, 1, 3, 1);
$table->mergeCellRange(1, 3, 1, 5);
$table->writeToCell(1, 3, 'Horizontal merged cells', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat());
$border = PHPRtfLite_Border::create(1, '#0000ff');
$table->setBorderForCellRange($border, 1, 3, 1, 5);
$table->mergeCellRange(3, 3, 5, 5);
$table->writeToCell(3, 3, 'Horizontal and vertical merged cells', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat());
$border = PHPRtfLite_Border::create(1, '#00ff00');
$table->setBorderForCellRange($border, 3, 3, 5, 5);
// send to browser
$rtf->sendRtf('merged_cells.rtf');
|