/** * tests getContent(). */ public function testGetContent() { $this->_parFormat->setIndentLeft(5); $this->_parFormat->setIndentRight(5); $this->_parFormat->setSpaceBefore(5); $this->_parFormat->setSpaceAfter(5); $this->_parFormat->setIndentFirstLine(3); $this->_parFormat->setSpaceBetweenLines(1.2); $this->_parFormat->setShading(50); $this->assertEquals('\\ql \\fi1701 \\li2835 \\ri2835 \\sb100 \\sa100 \\sl288 \\shading5000 ', $this->_parFormat->getContent()); }
<?php $dir = dirname(__FILE__); require_once $dir . '/../lib/PHPRtfLite.php'; // register PHPRtfLite class loader PHPRtfLite::registerAutoloader(); // rtf document $rtf = new PHPRtfLite(); //paragraph formats $parFormat = new PHPRtfLite_ParFormat(); $parGreyLeft = new PHPRtfLite_ParFormat(); $parGreyLeft->setShading(10); $parGreyCenter = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER); $parGreyCenter->setShading(10); // header $header = $rtf->addHeader('first'); $header->addImage($dir . '/sources/rtf_thumb.jpg', $parFormat); $header->writeText('Image in header.', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat()); $sect = $rtf->addSection(); $sect->writeText('Images with PHPRtfLite.', new PHPRtfLite_Font(14), new PHPRtfLite_ParFormat('center')); $sect->writeText('<br>Here is .jpg image. <tab>', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat()); $sect->addImage($dir . '/sources/rtf_thumb.jpg', null); $sect->writeText('<br>Here is .png image. <tab>', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat()); $sect->addImage($dir . '/sources/html.png', null); $sect->writeText('<br><br><b>Formating sizes of images:</b>', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat()); $table = $sect->addTable(); $table->addRows(3, 4.5); $table->addRow(6); $table->addColumnsList(array(7.5, 6.5)); $table->writeToCell(1, 1, '<br> Original size.', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat()); //getting cell object, writing text and adding image
$fontHead = new PHPRtfLite_Font(12, 'Arial'); $fontSmall = new PHPRtfLite_Font(3); $fontAnimated = new PHPRtfLite_Font(10); $fontLink = new PHPRtfLite_Font(10, 'Helvetica', '#0000cc'); $parBlack = new PHPRtfLite_ParFormat(); $parBlack->setIndentRight(9); $parBlack->setBackgroundColor('#000000'); $parBlack->setSpaceBefore(12); $parHead = new PHPRtfLite_ParFormat(); $parHead->setSpaceBefore(3); $parHead->setSpaceAfter(8); $parSimple = new PHPRtfLite_ParFormat(); $parSimple->setIndentLeft(5); $parSimple->setIndentRight(0.5); $parPhp = new PHPRtfLite_ParFormat(); $parPhp->setShading(5); $border = PHPRtfLite_Border::create($rtf, 1, '#000000', 'dash', 0.3); $parPhp->setBorder($border); $parPhp->setIndentLeft(5); $parPhp->setIndentRight(0.5); //section $sect = $rtf->addSection(); //table $table = $sect->addTable(); $table->addRows(1); $table->addRows(1); $table->addColumn(1); $table->addColumn(14); $cell = $table->getCell(1, 2); $cell->writeText('Testing paragraphs in table cells.', new PHPRtfLite_Font(14, 'Arial'), $parHead); $cell = $table->getCell(2, 2);