当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPRtfLite类代码示例

本文整理汇总了PHP中PHPRtfLite的典型用法代码示例。如果您正苦于以下问题:PHP PHPRtfLite类的具体用法?PHP PHPRtfLite怎么用?PHP PHPRtfLite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHPRtfLite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRender

 /**
  * tests render
  */
 public function testRender()
 {
     $header = new PHPRtfLite_Container_Header($this->_rtf);
     $header->writeText('hello world and see my rtf header!');
     $header->render();
     $this->assertEquals('{\\header {hello world and see my rtf header!}' . "\r\n\\par}\r\n", $this->_rtf->getWriter()->getContent());
 }
开发者ID:phprtflite,项目名称:phprtflite,代码行数:10,代码来源:HeaderTest.php

示例2: __construct

 /**
  * Constructor
  *
  * @param PHPRtfLite    $rtf
  * @param string        $type
  */
 public function __construct(PHPRtfLite $rtf, $type = self::TYPE_ALL)
 {
     $this->_rtf = $rtf;
     $this->_type = $type;
     if ($this->_type == self::TYPE_FIRST) {
         $rtf->setSpecialLayoutForFirstPage(true);
     }
 }
开发者ID:sbogdanov108,项目名称:db_to_text,代码行数:14,代码来源:Header.php

示例3: testRender

 /**
  * tests render().
  */
 public function testRender()
 {
     $hyperlink = new PHPRtfLite_Element_Hyperlink($this->_rtf, 'My link text!');
     $hyperlink->setHyperlink('http://www.phprtf.com/');
     $hyperlink->render();
     $expected = '{\\field {\\*\\fldinst {HYPERLINK "http://www.phprtf.com/"}}{\\fldrslt {My link text!}}}';
     $this->assertEquals($expected, trim($this->_rtf->getWriter()->getContent()));
 }
开发者ID:phprtflite,项目名称:phprtflite,代码行数:11,代码来源:HyperlinkTest.php

示例4: testRenderImageUnresized

 /**
  *
  */
 public function testRenderImageUnresized()
 {
     $source = dirname(__FILE__) . '/../../samples/sources/rtf_thumb.jpg';
     if (!is_file($source)) {
         $this->markTestSkipped('Source image file could not be found!');
         return;
     }
     $image = PHPRtfLite_Image::createFromFile($this->_rtf, $source);
     $image->render();
     $expected = self::getRtfThumbHexCode(510, 510);
     $this->assertEquals($expected, $this->_rtf->getWriter()->getContent());
 }
开发者ID:phprtflite,项目名称:phprtflite,代码行数:15,代码来源:ImageTest.php

示例5: render

 /**
  * renders rtf code for cell
  */
 public function render()
 {
     $stream = $this->_rtf->getWriter();
     $stream->write("\r\n");
     // renders container elements
     parent::render();
     $containerElements = $this->getElements();
     $numOfContainerElements = count($containerElements);
     if ($this->_table->isNestedTable()) {
         // if last container element is not a nested table, close cell
         if ($numOfContainerElements == 0 || !$containerElements[$numOfContainerElements - 1] instanceof PHPRtfLite_Table_Nested) {
             $stream->write('{\\nestcell{\\nonesttables\\par}\\pard}' . "\r\n");
             // if last cell of row, close row
             if ($this->getColumnIndex() == $this->_table->getColumnsCount()) {
                 $stream->write('{\\*\\nesttableprops ');
                 $row = $this->_table->getRow($this->_rowIndex);
                 $this->_table->renderRowDefinition($row);
                 $stream->write('\\nestrow}');
             }
         }
     } else {
         if ($numOfContainerElements > 0 && $containerElements[$numOfContainerElements - 1] instanceof PHPRtfLite_Table_Nested) {
             $stream->write('\\intbl\\itap1\\~');
         }
         // closing tag for cell definition
         $stream->write('\\cell');
     }
     $stream->write("\r\n");
 }
开发者ID:sbogdanov108,项目名称:db_to_text,代码行数:32,代码来源:Cell.php

示例6: getTypeAsRtfCode

 /**
  * Gets type as rtf code
  *
  * @return string rtf code
  * @throws PHPRtfLite_Exception, if type is not allowed,
  *   because of the rtf document specific settings.
  */
 protected function getTypeAsRtfCode()
 {
     switch ($this->_type) {
         case self::TYPE_ALL:
             if (!$this->_rtf->isOddEvenDifferent()) {
                 return 'footer';
             }
             throw new PHPRtfLite_Exception('Footer type ' . $this->_type . ' is not allowed, when using odd even different!');
         case self::TYPE_LEFT:
             if ($this->_rtf->isOddEvenDifferent()) {
                 return 'footerl';
             }
             throw new PHPRtfLite_Exception('Footer type ' . $this->_type . ' is not allowed, when using not odd even different!');
         case self::TYPE_RIGHT:
             if ($this->_rtf->isOddEvenDifferent()) {
                 return 'footerr';
             }
             throw new PHPRtfLite_Exception('Footer type ' . $this->_type . ' is not allowed, when using not odd even different!');
         case self::TYPE_FIRST:
             if ($this->getFirstPageHasSpecialLayout()) {
                 return 'footerf';
             }
             throw new PHPRtfLite_Exception('Footer type ' . $this->_type . ' is not allowed, when using not special layout for first page!');
         default:
             throw new PHPRtfLite_Exception('Footer type is not defined! You gave me: ', $this->_type);
     }
 }
开发者ID:TRWirahmana,项目名称:sekretariat,代码行数:34,代码来源:Footer.php

示例7: render

 /**
  * renders list
  */
 public function render()
 {
     $stream = $this->_rtf->getWriter();
     $number = 0;
     foreach ($this->_items as $item) {
         // item is a list
         if ($item instanceof PHPRtfLite_List_Numbering) {
             if ($this instanceof PHPRtfLite_List_Numbering) {
                 $item->setPrefix($this->_prefix . $this->getNumber($number) . $this->_separator);
                 $item->setSuffix($this->_suffix);
             }
         } else {
             $number++;
             $listCharFontIndex = $this->getListCharFontIndex();
             $listCharacter = $this->getListCharacter($number);
             $listCharDefinition = '{\\*\\pn\\pnlvlblt' . '\\pnf' . $listCharFontIndex;
             if ($this->_font) {
                 $listCharDefinition .= '\\pnfs' . $this->_font->getSize() * 2;
                 if ($color = $this->_font->getColor()) {
                     $listCharDefinition .= '\\pncf' . $this->_rtf->getColorTable()->getColorIndex($color);
                 }
             }
             $listCharDefinition .= '\\pnindent0{\\pntxtb ' . $listCharacter . '}}';
             $textIndent = $this->_listIndent + $this->_textIndent;
             $stream->write('\\nowidctlpar\\fi-' . $this->_listIndent . '\\li' . $textIndent . "\r\n");
             $stream->write($listCharDefinition);
         }
         // renders item
         $item->render();
         if (false == $item instanceof PHPRtfLite_List) {
             $stream->write('\\par\\pard' . "\r\n");
         }
     }
 }
开发者ID:sbogdanov108,项目名称:db_to_text,代码行数:37,代码来源:List.php

示例8: __construct

 /**
  * Constructor
  * @param   integer     $size   size of border
  * @param   string      $color  color of border (example '#ff0000' or '#f00')
  * @param   string      $type   represented by class constants PHPRtfLite_Border_Format::TYPE_*<br>
  *   Possible values:<br>
  *     TYPE_SINGLE  => 'single'<br>
  *     TYPE_DOT      = 'dot'<br>
  *     TYPE_DASH     = 'dash'<br>
  *     TYPE_DOTDASH  = 'dotdash'<br>
  * @param   float       $space  space between borders and the paragraph
  */
 public function __construct($size = 0, $color = null, $type = null, $space = 0)
 {
     $this->_size = $size * PHPRtfLite::SPACE_IN_POINTS;
     $this->_type = $type;
     if ($color) {
         $this->_color = PHPRtfLite::convertHexColorToRtf($color);
     }
     $this->_space = round($space * PHPRtfLite::TWIPS_IN_CM);
 }
开发者ID:edurbs,项目名称:sobcontrole,代码行数:21,代码来源:Format.php

示例9: 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;
 }
开发者ID:phprtflite,项目名称:phprtflite,代码行数:25,代码来源:CellTest.php

示例10: render

 /**
  * renders rtf code for that container
  *
  * @return string rtf code
  */
 public function render()
 {
     $stream = $this->_rtf->getWriter();
     if ($this instanceof PHPRtfLite_Table_Cell && $this->countElements() == 0) {
         $stream->write('{');
         $font = $this->getCellFont($this);
         if ($font) {
             $stream->write($font->getContent());
         }
         if (!$this->isVerticalMerged() && !$this->isHorizontalMerged() || $this->isVerticalMergedFirstInRange()) {
             $stream->write('{\\~}');
         }
         $stream->write('}\\intbl');
     }
     $lastKey = $this->countElements() - 1;
     foreach ($this->_elements as $key => $element) {
         if ($this instanceof PHPRtfLite_Table_Cell && !$element instanceof PHPRtfLite_Table) {
             // table cell initialization
             $stream->write('\\intbl\\itap' . $this->getTable()->getNestDepth() . "\r\n");
             $stream->write($this->getCellAlignment());
         }
         if ($element instanceof PHPRtfLite_Element_Plain) {
             $element->render();
             continue;
         }
         $parFormat = null;
         if (!$element instanceof PHPRtfLite_Table) {
             $parFormat = $element->getParFormat();
         }
         if ($parFormat) {
             $stream->write($this->_pard);
             if ($this instanceof PHPRtfLite_Table_Cell && $lastKey != $key) {
                 $stream->write('{');
             }
             $stream->write($parFormat->getContent());
         }
         $font = $this->getCellFont($element);
         if ($font) {
             $stream->write($font->getContent());
         }
         $element->render();
         if ($this->needToAddParagraphEnd($key)) {
             $stream->write('\\par ');
         }
         if ($font) {
             $stream->write($font->getClosingContent());
         }
         if ($parFormat && $this instanceof PHPRtfLite_Table_Cell && $lastKey != $key) {
             $stream->write('}');
         }
     }
 }
开发者ID:kalinin-sanja,项目名称:FamilyTree,代码行数:57,代码来源:Base.php

示例11: render

 /**
  * renders form field
  */
 public function render()
 {
     $stream = $this->_rtf->getWriter();
     $stream->write(' ');
     if ($this->_font) {
         $stream->write('{' . $this->_font->getContent());
     }
     $defaultValue = PHPRtfLite_Utf8::getUnicodeEntities($this->_defaultValue, $this->_rtf->getCharset());
     $content = '{\\field' . '{\\*\\fldinst ' . $this->getType() . '  {\\*\\formfield' . $this->getRtfCode() . '}' . '}{\\fldrslt ' . $defaultValue . '}}';
     $stream->write($content);
     if ($this->_font) {
         $stream->write($this->_font->getClosingContent() . '}');
     }
     $stream->write(' ');
 }
开发者ID:sbogdanov108,项目名称:db_to_text,代码行数:18,代码来源:FormField.php

示例12: Generate_Content

 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;
 }
开发者ID:naivists,项目名称:PHPUnit,代码行数:24,代码来源:rtfgradefile.class.php

示例13: onGenerate

    public function onGenerate()
    {
        try {
            TTransaction::open('atividade');
            $object = $this->form->getData();
            $desenvolvimento = new RequisitoDesenvolvimento(1);
            $cliente_id = $desenvolvimento->ticket->solicitante_id;
            $responsavel_id = $desenvolvimento->ticket->responsavel_id;
            $pessoa = new Pessoa($cliente_id);
            $cliente = $pessoa->pessoa_nome;
            $pessoa = new Pessoa($responsavel_id);
            $responsavel = $pessoa->pessoa_nome;
            if (!class_exists('PHPRtfLite_Autoloader')) {
                PHPRtfLite::registerAutoloader();
            }
            $tr = new TTableWriterRTF(array(500));
            $tr->addStyle('title', 'Arial', '10', 'BI', '#000000', '#ffffff');
            $tr->addStyle('datap', 'Arial', '10', '', '#000000', '#ffffff');
            $string = new StringsUtil();
            $data = $desenvolvimento->data_cadastro;
            $data = explode('-', $data);
            $desenvolvimento->ticket->data_prevista ? $data_prevista = $string->formatDateBR($desenvolvimento->ticket->data_prevista) : '___/___/___';
            $cabecalho = 'DTR010 - Solicitação de Desenvolvimento
Número: ' . $desenvolvimento->id . '/' . $data[0] . ' Data: ' . $string->formatDateBR($desenvolvimento->data_cadastro) . ' Prazo de entrega: ' . $data_prevista . ' Qtde de Horas: ' . strstr($desenvolvimento->ticket->orcamento_horas, ':', true) . ' Ticket: ' . $desenvolvimento->ticket_id . '
Benefício: ( )+Receita ( )-Despesa ( )+Eficiência ( )-NDA
Título: ' . $desenvolvimento->titulo . '
Sistema: ' . $desenvolvimento->ticket->sistema->nome . '      Módulo:                                   Rotina: ' . $desenvolvimento->rotina . '
Cliente: ' . $cliente . ' Solicitante/Dpto: ' . $responsavel;
            $tr->addRow();
            $tr->addCell($cabecalho, 'left', 'title');
            $tr->addRow();
            $tr->addCell('<br /><b>Objetivo:</b> <br />' . $desenvolvimento->objetivo, 'left', 'datap');
            $tr->addRow();
            $tr->addCell('<br /><b>Entrada: </b><br />' . $desenvolvimento->entrada, 'left', 'datap');
            $tr->addRow();
            $tr->addCell('<br /><b>Processamento: </b><br />' . $desenvolvimento->processamento, 'left', 'datap');
            $tr->addRow();
            $tr->addCell('<br /><b>Saida: </b><br />' . $desenvolvimento->saida, 'left', 'datap');
            $nome = 'DTR010 ' . $desenvolvimento->id . ' - ' . $data[0] . ' - ' . $desenvolvimento->titulo;
            $tr->save("app/output/{$nome}.rtf");
            parent::openFile("app/output/{$nome}.rtf");
            new TMessage('info', 'DTR gerado com sucesso!');
            TTransaction::close();
        } catch (Exception $e) {
            new TMessage('error', $e->getMessage);
        }
    }
开发者ID:jhonleandres,项目名称:Atividades,代码行数:47,代码来源:GeradorDescricao.class.php

示例14: __construct

 public function __construct()
 {
     if (!class_exists('PHPRtfLite_Autoloader')) {
         PHPRtfLite::registerAutoloader();
     }
     $this->rtf = new PHPRtfLite();
     $this->rtf->setCharset("UTF-8");
     $this->rtf->setPaperWidth(21);
     // A4
     $this->rtf->setPaperHeight(29);
     //$this->rtf->setLandscape();
     $this->rtf->setMargins(2, 2, 2, 2);
     $this->JUSTIFY = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_JUSTIFY);
     $this->LEFT = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
     $this->CENTER = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
     $this->RIGHT = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_RIGHT);
     $this->paragraphFormat = $this->JUSTIFY;
     $this->section = $this->rtf->addSection();
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:19,代码来源:Report.class.php

示例15: 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
开发者ID:jfrank1500,项目名称:curso_php,代码行数:31,代码来源:images.php


注:本文中的PHPRtfLite类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。