當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。