本文整理汇总了PHP中PHPRtfLite::addSection方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPRtfLite::addSection方法的具体用法?PHP PHPRtfLite::addSection怎么用?PHP PHPRtfLite::addSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPRtfLite
的用法示例。
在下文中一共展示了PHPRtfLite::addSection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWriteRtfCode
public function testWriteRtfCode()
{
$section = $this->_rtf->addSection();
$section->writeRtfCode('This is a Unit Test text!');
$this->assertEquals(1, $section->countElements());
}
示例2: testAddSection
/**
* tests addSection
* @covers PHPRtfLite::getSections
*/
public function testAddSection()
{
$section = $this->_rtf->addSection();
$this->assertInstanceOf('PHPRtfLite_Container_Section', $section);
$this->_rtf->addSection(new PHPRtfLite_Container_Section($this->_rtf));
$this->assertEquals(2, count($this->_rtf->getSections()));
}
示例3: testSetBorderForCellWithRow1Column1
/**
* tests setBorder on cell 1x1
*
* @param PHPRtfLite_Table $table
* @return PHPRtfLite_Table
*/
public function testSetBorderForCellWithRow1Column1()
{
$rtf = new PHPRtfLite();
$section = $rtf->addSection();
$table = $section->addTable();
// creating cells (2 rows x 2 columns)
$table->addRowList(array(2, 2));
$table->addColumnsList(array(7, 7));
$border = new PHPRtfLite_Border($table->getRtf());
$border->setBorders(new PHPRtfLite_Border_Format(1, '#000'));
$cell1x1 = $table->getCell(1, 1);
$cell1x2 = $table->getCell(1, 2);
$cell2x1 = $table->getCell(2, 1);
$cell1x1->setBorder($border);
$this->assertEquals('#000', $cell1x1->getBorder()->getBorderRight()->getColor());
$this->assertEquals('#000', $cell1x2->getBorder()->getBorderLeft()->getColor());
$this->assertEquals('#000', $cell2x1->getBorder()->getBorderTop()->getColor());
return $table;
}
示例4: PHPRtfLite
function Generate_Content()
{
PHPRtfLite::registerAutoloader();
$largerFont = new PHPRtfLite_Font(16, 'Courier New');
$largerFont->setBold();
$smallerFont = new PHPRtfLite_Font(12, 'Times New Roman');
$tableFont = new PHPRtfLite_Font(10, 'Courier New');
//Izveido pašu dokumentu
$rtf = new PHPRtfLite();
$parHead = new PHPRtfLite_ParFormat();
$parHead->setSpaceBefore(3);
$parHead->setSpaceAfter(8);
$parBody = new PHPRtfLite_ParFormat();
$parBody->setSpaceBefore(1);
//Izveido pirmo sekciju
$sect =& $rtf->addSection();
$sect->writeText("Atzīmju izraksts", $largerFont, $parHead);
$sect->writeText("Skolnieks: " . $this->studentName, $smallerFont, $parHead);
for ($i = 0; $i < count($this->grades); $i++) {
$grade = $this->grades[$i];
$sect->writeText(sprintf("%s %s %s", $grade["date"], $grade["lesson"], $grade["grade"]), $tableFont, $parBody);
}
$this->fileContents = $rtf;
}
示例5: while
$fontFooter = new PHPRtfLite_Font(8, 'Arial', '#000000');
$alignFooter = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
$footer->writeText('Used cars for sale - <pagenum>', $fontFooter, $alignFooter);
// Определить шрифты
$fontH1 = new PHPRtfLite_Font(16, 'Arial', '#4E9C93');
$fontH2 = new PHPRtfLite_Font(14, 'Arial', '#4E9C93');
$fontP = new PHPRtfLite_Font(12, 'Helvetica', '#000000');
// Вертикальное форматирование текста
$formatH1 = new PHPRtfLite_ParFormat();
$formatH1->setSpaceAfter(8);
$formatH2 = new PHPRtfLite_ParFormat();
$formatH2->setSpaceAfter(6);
$formatP = new PHPRtfLite_ParFormat();
$formatP->setSpaceAfter(3);
// Содержание страницы
$section = $rtf->addSection();
$section->writeText('Used Cars for Sale', $fontH1, $formatH1);
while ($row = getRow($result)) {
$section->writeText($row['make'], $fontH2, $formatH2);
$section->setNoBreak();
$section->writeText('<bullet> Price: $' . number_format($row['price'], 2), $fontP, $formatP);
$section->writeText('<bullet> Mileage: ' . number_format($row['mileage']), $fontP, $formatP);
$section->writeText('<bullet> Transmission: ' . $row['transmission'], $fontP, $formatP);
$section->writeText($row['description'] . '<hr>', $fontP, $formatP);
}
// Выходной файл
$rtf->sendRtf('cars.rtf');
} catch (Exception $e) {
$error = $e->getMessage();
}
}
示例6: dirname
<?php
$dir = dirname(__FILE__);
$jpeg = $dir . '/sources/rtf_thumb.jpg';
$png = $dir . '/sources/html.png';
$wmf = $dir . '/sources/test.wmf';
require_once $dir . '/../lib/PHPRtfLite.php';
// register PHPRtfLite class loader
PHPRtfLite::registerAutoloader();
// rtf document
$rtf = new PHPRtfLite();
$sect = $rtf->addSection();
$sect->writeText('Images (as files) with PHPRtfLite.');
$table = $sect->addTable();
$table->addRows(4);
$table->addColumnsList(array(4, 4));
$table->writeToCell(1, 1, 'JPEG');
$table->addImageToCell(1, 2, $jpeg);
$table->writeToCell(2, 1, 'PNG');
$table->addImageToCell(2, 2, $png);
$table->writeToCell(3, 1, 'WMF');
$table->addImageToCell(3, 2, $wmf, null, 4);
$missingImage = '/some/image/that/does/not/!exist!.png';
$table->writeToCell(4, 1, 'Missing image or not readable');
$table->addImageToCell(4, 2, $missingImage);
$sect = $rtf->addSection();
$sect->writeText('Images (as strings) with PHPRtfLite.');
$table = $sect->addTable();
$table->addRows(3);
$table->addColumnsList(array(4, 4));
$table->getCell(1, 1)->writeText('JPEG');
示例7: PHPRtfLite
}*/
/*$project_id = $_GET["project_id"];
$ps_id = $_GET["ps_id"];
$qup = mysql_query("select * from t_project where project_id = $project_id");
$project_info = mysql_fetch_object($qup);
$qup = mysql_query("select *,date_format(ps_test_tanggal,'%d-%b-%Y') ps_test_tanggal2 from t_project_source where ps_id = $ps_id");
$project_source_info = mysql_fetch_object($qup);*/
}
// Init
$null = null;
PHPRtfLite::registerAutoloader();
$parFormat = new PHPRtfLite_ParFormat();
$rtf = new PHPRtfLite();
//setLandscape()
$rtf->setLandscape();
//$rtf->setMargins(3,2,3,2);
//_createHeader($project_info);
$rtf->setMargins(3, 2, 3, 2);
$sect =& $rtf->addSection();
//_createTitle($project_info);
_createTable();
//
/*$sect = &$rtf->addSection();
_createTable(3,3);
//
$sect = &$rtf->addSection();
_createUraian();*/
$namafile = "Schedule.rtf";
$rtf->sendRtf($namafile);
示例8: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
$rtf = new PHPRtfLite();
$this->_table = $rtf->addSection()->addTable();
}