本文整理汇总了PHP中PHPRtfLite::addHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPRtfLite::addHeader方法的具体用法?PHP PHPRtfLite::addHeader怎么用?PHP PHPRtfLite::addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPRtfLite
的用法示例。
在下文中一共展示了PHPRtfLite::addHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?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
示例2: dirname
<?php
$dir = dirname(__FILE__);
require_once $dir . '/../lib/PHPRtfLite.php';
// register PHPRtfLite class loader
PHPRtfLite::registerAutoloader();
//rtf document
$rtf = new PHPRtfLite();
$rtf->setHyphenation();
$header = $rtf->addHeader();
$header->writeText("PHPRtfLite class library. This is page - <pagenum> of <pagetotal> -", new PHPRtfLite_Font(), new PHPRtfLite_ParFormat());
$table = $header->addTable();
$table->addRows(1);
$table->addColumnsList(array(3, 4, 3));
$cell = $table->getCell(1, 1);
$cell->setTextAlignment(PHPRtfLite_Table_Cell::TEXT_ALIGN_LEFT);
$cell->writeText('Cell with left alignment');
$cell = $table->getCell(1, 2);
$cell->setTextAlignment(PHPRtfLite_Table_Cell::TEXT_ALIGN_CENTER);
$cell->writeText('Cell with center alignment');
$cell = $table->getCell(1, 3);
$cell->setTextAlignment(PHPRtfLite_Table_Cell::TEXT_ALIGN_RIGHT);
$cell->writeText('Cell with right alignment');
$header->writeText('Text after table');
$section = $rtf->addSection();
$section->writeText('
Text with hyphenation activated:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eleifend sem dapibus erat congue quis pharetra neque porta. Cras orci quam, consectetur id vestibulum non, iaculis sit amet neque. Maecenas in tincidunt urna. Curabitur quis justo ac augue volutpat laoreet. Pellentesque molestie vestibulum diam, eu facilisis est tincidunt et. Phasellus scelerisque elit et enim luctus mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur semper, felis vehicula pharetra laoreet, erat augue porttitor nisl, quis ullamcorper purus felis vel augue. Etiam quis massa ultrices nisi rutrum auctor. Integer mollis sapien quis mauris suscipit nec dictum felis interdum.
Sed ut arcu metus. Cras lorem dolor, pharetra ut congue vel, pellentesque ac arcu. Praesent non lectus nulla. Nam mollis velit a dui lobortis tincidunt. Duis sed ipsum elit. Pellentesque urna risus, commodo in fringilla sit amet, euismod sit amet lectus. Nulla purus elit, porttitor ac viverra nec, consectetur at arcu. Pellentesque eget magna eget justo euismod mattis ut nec odio. Proin gravida est eu augue ullamcorper eu mollis orci convallis. Curabitur adipiscing lacus vitae ante accumsan ut ornare elit ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.');
示例3: testAddHeaderAllException
/**
* tests addHeader with expected exception for all page header
* @expectedException PHPRtfLite_Exception
*/
public function testAddHeaderAllException()
{
$this->_rtf->setOddEvenDifferent();
$this->_rtf->addHeader(PHPRtfLite_Container_Header::TYPE_ALL);
$this->_rtf->getContent();
}
示例4: PHPRtfLite
';
$times12 = new PHPRtfLite_Font(13, 'Times new Roman');
$arial14 = new PHPRtfLite_Font(14, 'Arial', '#000066');
$parFormat = new PHPRtfLite_ParFormat();
//rtf document
$rtf = new PHPRtfLite();
//borders
$borderFormatBlue = new PHPRtfLite_Border_Format(1, '#0000ff');
$borderFormatRed = new PHPRtfLite_Border_Format(2, '#ff0000');
$border = new PHPRtfLite_Border($rtf, $borderFormatBlue, $borderFormatRed, $borderFormatBlue, $borderFormatRed);
$rtf->setBorder($border);
$rtf->setBorderSurroundsHeader();
$rtf->setBorderSurroundsFooter();
//headers
$rtf->setOddEvenDifferent();
$header = $rtf->addHeader(PHPRtfLite_Container_Header::TYPE_LEFT);
$header->writeText("PHPRtfLite class library. Left document header. This is page - <pagenum> of <pagetotal> -", $times12, $parFormat);
$header = $rtf->addHeader(PHPRtfLite_Container_Header::TYPE_RIGHT);
$header->writeText("PHPRtfLite class library. Right document header. This is page - <pagenum> of <pagetotal> -", $times12, $parFormat);
//section 1
$sect = $rtf->addSection();
$sect->setPaperHeight(16);
$sect->setPaperWidth(25);
//Borders overridden: No Borders
$border = PHPRtfLite_Border::create($rtf, 0);
$sect->setBorder($border);
$sect->setSpaceBetweenColumns(1);
$sect->setNumberOfColumns(2);
$sect->setLineBetweenColumns();
writeSectionText($sect, $arial14, $times12, $text, $text2, $text3);
//section 2