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


PHP Container::write方法代码示例

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


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

示例1: write

 /**
  * Write table
  *
  * @return string
  */
 public function write()
 {
     if (!$this->element instanceof \PhpOffice\PhpWord\Element\Table) {
         return '';
     }
     $content = '';
     $rows = $this->element->getRows();
     $rowCount = count($rows);
     if ($rowCount > 0) {
         $content .= '<table>' . PHP_EOL;
         foreach ($rows as $row) {
             /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */
             $rowStyle = $row->getStyle();
             // $height = $row->getHeight();
             $tblHeader = $rowStyle->isTblHeader();
             $content .= '<tr>' . PHP_EOL;
             foreach ($row->getCells() as $cell) {
                 $writer = new Container($this->parentWriter, $cell);
                 $cellTag = $tblHeader ? 'th' : 'td';
                 $content .= "<{$cellTag}>" . PHP_EOL;
                 $content .= $writer->write();
                 $content .= "</{$cellTag}>" . PHP_EOL;
             }
             $content .= '</tr>' . PHP_EOL;
         }
         $content .= '</table>' . PHP_EOL;
     }
     return $content;
 }
开发者ID:Senasum,项目名称:PHPWord,代码行数:34,代码来源:Table.php

示例2: write

 /**
  * Write element
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     $xmlWriter->startElement('text:p');
     $containerWriter = new Container($xmlWriter, $element);
     $containerWriter->write();
     $xmlWriter->endElement();
 }
开发者ID:doit05,项目名称:relProject,代码行数:12,代码来源:TextRun.php

示例3: write

 /**
  * Write text run
  *
  * @return string
  */
 public function write()
 {
     $content = '';
     $content .= $this->writeOpening();
     $writer = new Container($this->parentWriter, $this->element);
     $content .= $writer->write();
     $content .= $this->writeClosing();
     return $content;
 }
开发者ID:FabianoFaria,项目名称:ULA_front,代码行数:14,代码来源:TextRun.php

示例4: write

 /**
  * Write textrun element
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     $this->writeOpeningWP();
     $containerWriter = new Container($xmlWriter, $element);
     $containerWriter->write();
     $this->writeClosingWP();
 }
开发者ID:hcvcastro,项目名称:pxp,代码行数:12,代码来源:TextRun.php

示例5: write

 /**
  * Write element
  */
 public function write()
 {
     $xmlWriter = $this->getXmlWriter();
     $element = $this->getElement();
     if (!$element instanceof \PhpOffice\PhpWord\Element\Table) {
         return;
     }
     $rows = $element->getRows();
     $rowCount = count($rows);
     $colCount = $element->countColumns();
     if ($rowCount > 0) {
         $xmlWriter->startElement('table:table');
         $xmlWriter->writeAttribute('table:name', $element->getElementId());
         $xmlWriter->writeAttribute('table:style', $element->getElementId());
         $xmlWriter->startElement('table:table-column');
         $xmlWriter->writeAttribute('table:number-columns-repeated', $colCount);
         $xmlWriter->endElement();
         // table:table-column
         foreach ($rows as $row) {
             $xmlWriter->startElement('table:table-row');
             /** @var $row \PhpOffice\PhpWord\Element\Row Type hint */
             foreach ($row->getCells() as $cell) {
                 $xmlWriter->startElement('table:table-cell');
                 $xmlWriter->writeAttribute('office:value-type', 'string');
                 $containerWriter = new Container($xmlWriter, $cell);
                 $containerWriter->write();
                 $xmlWriter->endElement();
                 // table:table-cell
             }
             $xmlWriter->endElement();
             // table:table-row
         }
         $xmlWriter->endElement();
         // table:table
     }
 }
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:39,代码来源:Table.php


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