本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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();
}
示例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
}
}