PHPRtfLite::registerAutoloader(); // *** rtf document instance *** $rtf = new PHPRtfLite(); // *** Add section *** $sect = $rtf->addSection(); // *** RTF Settings *** $arial10 = new PHPRtfLite_Font(10, 'Arial'); $arial12 = new PHPRtfLite_Font(12, 'Arial'); $arial14 = new PHPRtfLite_Font(14, 'Arial', '#000066'); //Fonts $fontHead = new PHPRtfLite_Font(12, 'Arial'); $fontSmall = new PHPRtfLite_Font(3); $fontAnimated = new PHPRtfLite_Font(10); $fontLink = new PHPRtfLite_Font(10, 'Helvetica', '#0000cc'); $parNames = new PHPRtfLite_ParFormat(); $parNames->setBackgroundColor('#FFFFFF'); $parNames->setIndentLeft(0); $parNames->setSpaceBefore(0); $parNames->setSpaceAfter(0); $parHead = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER); $parHead->setSpaceBefore(3); $parHead->setSpaceAfter(8); $parHead->setBackgroundColor('#baf4c1'); $parGen = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER); $parGen->setSpaceBefore(0); $parGen->setSpaceAfter(8); $parGen->setBackgroundColor('#baf4c1'); $parSimple = new PHPRtfLite_ParFormat(); $parSimple->setIndentLeft(2.5); $parSimple->setIndentRight(0.5); // *** Generate title of RTF file ***
// *** RTF Settings *** $arial12 = new PHPRtfLite_Font(12, 'Arial'); $arial14 = new PHPRtfLite_Font(14, 'Arial', '#000066'); //Fonts $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(12.5); //$parBlack->setBackgroundColor('#000000'); $parBlack->setSpaceBefore(12); $parHead = new PHPRtfLite_ParFormat(); $parHead->setSpaceBefore(3); $parHead->setSpaceAfter(8); $parHead->setBackgroundColor('#baf4c1'); $parSimple = new PHPRtfLite_ParFormat(); $parSimple->setIndentLeft(1); $parSimple->setIndentRight(0.5); $par_child_text = new PHPRtfLite_ParFormat(); $par_child_text->setIndentLeft(0.5); $par_child_text->setIndentRight(0.5); //$rtf->setMargins(3, 1, 1 ,2); // *** Generate title of RTF file *** @($persDb = $db_functions->get_person($main_person)); // *** Use class to process person *** $pers_cls = new person_cls(); $pers_cls->construct($persDb); $name = $pers_cls->person_name($persDb); if (!$descendant_report == false) { $title = __('Descendant report') . __(' of ') . $name["standard_name"];
$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); $cell->addEmptyParagraph($fontSmall, $parBlack); $cell->writeText('Various paragraphs', $fontHead, $parHead); $par = new PHPRtfLite_ParFormat('center'); $par->setIndentLeft(10); $par->setBackgroundColor('#99ccff'); $par->setSpaceBetweenLines(2); $cell->writeText('Alignment: center Indent Left: 10 BackColor: #99ccff', new PHPRtfLite_Font(8, 'Verdana'), $par); $par = new PHPRtfLite_ParFormat('right'); $par->setIndentLeft(5); $par->setIndentRight(5); $par->setBackgroundColor('#ffcc99'); $border = PHPRtfLite_Border::create($rtf, 1, '#ff0000'); $par->setBorder($border); $cell->addEmptyParagraph(); $cell->writeText('Alignment: right Indent Left: 5 Indent Right: 10 BackColor: #ffcc99 Border: red', new PHPRtfLite_Font(8, 'Verdana'), $par); // save rtf document $rtf->save($dir . '/generated/' . basename(__FILE__, '.php') . '.rtf');