本文整理汇总了PHP中PhpOffice\PhpWord\Shared\XMLWriter::writeRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::writeRaw方法的具体用法?PHP XMLWriter::writeRaw怎么用?PHP XMLWriter::writeRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpOffice\PhpWord\Shared\XMLWriter
的用法示例。
在下文中一共展示了XMLWriter::writeRaw方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeCustomProperty
/**
* Write individual property
*
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $property
* @param string $value
* @return void
*
* @todo Handle other `$type`: double|date|dateTime|duration|boolean (4th arguments)
*/
private function writeCustomProperty(XMLWriter $xmlWriter, $property, $value)
{
$xmlWriter->startElement('meta:user-defined');
$xmlWriter->writeAttribute('meta:name', $property);
// if ($type !== null) {
// $xmlWriter->writeAttribute('meta:value-type', $type);
// }
$xmlWriter->writeRaw($value);
$xmlWriter->endElement();
// meta:user-defined
}
示例2: writeFieldMark
/**
* Write TOC Field
*/
private function writeFieldMark(XMLWriter $xmlWriter, TOCElement $element)
{
$minDepth = $element->getMinDepth();
$maxDepth = $element->getMaxDepth();
$xmlWriter->startElement('w:r');
$xmlWriter->startElement('w:fldChar');
$xmlWriter->writeAttribute('w:fldCharType', 'begin');
$xmlWriter->endElement();
$xmlWriter->endElement();
$xmlWriter->startElement('w:r');
$xmlWriter->startElement('w:instrText');
$xmlWriter->writeAttribute('xml:space', 'preserve');
$xmlWriter->writeRaw("TOC \\o {$minDepth}-{$maxDepth} \\h \\z \\u");
$xmlWriter->endElement();
$xmlWriter->endElement();
$xmlWriter->startElement('w:r');
$xmlWriter->startElement('w:fldChar');
$xmlWriter->writeAttribute('w:fldCharType', 'separate');
$xmlWriter->endElement();
$xmlWriter->endElement();
}
示例3: writeNote
/**
* Write note item
*
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\Footnote|\PhpOffice\PhpWord\Element\Endnote $element
*/
protected function writeNote(XMLWriter $xmlWriter, $element)
{
$xmlWriter->startElement($this->elementNode);
$xmlWriter->writeAttribute('w:id', $element->getRelationId());
$xmlWriter->startElement('w:p');
// Paragraph style
$styleWriter = new ParagraphStyleWriter($xmlWriter, $element->getParagraphStyle());
$styleWriter->setIsInline(true);
$styleWriter->write();
// Reference symbol
$xmlWriter->startElement('w:r');
$xmlWriter->startElement('w:rPr');
$xmlWriter->startElement('w:rStyle');
$xmlWriter->writeAttribute('w:val', $this->refStyle);
$xmlWriter->endElement();
// w:rStyle
$xmlWriter->endElement();
// w:rPr
$xmlWriter->writeElement($this->refNode);
$xmlWriter->endElement();
// w:r
// Empty space after refence symbol
$xmlWriter->startElement('w:r');
$xmlWriter->startElement('w:t');
$xmlWriter->writeAttribute('xml:space', 'preserve');
$xmlWriter->writeRaw(' ');
$xmlWriter->endElement();
// w:t
$xmlWriter->endElement();
// w:r
$this->writeContainerElements($xmlWriter, $element);
$xmlWriter->endElement();
// w:p
$xmlWriter->endElement();
// $this->elementNode
}
示例4: writeSeriesItem
/**
* Write series items.
*
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $type
* @param array $values
* @return void
*/
private function writeSeriesItem(XMLWriter $xmlWriter, $type, $values)
{
$types = array('cat' => array('c:cat', 'c:strLit'), 'val' => array('c:val', 'c:numLit'), 'xVal' => array('c:xVal', 'c:strLit'), 'yVal' => array('c:yVal', 'c:numLit'));
list($itemType, $itemLit) = $types[$type];
$xmlWriter->startElement($itemType);
$xmlWriter->startElement($itemLit);
$index = 0;
foreach ($values as $value) {
$xmlWriter->startElement('c:pt');
$xmlWriter->writeAttribute('idx', $index);
$xmlWriter->startElement('c:v');
$xmlWriter->writeRaw($value);
$xmlWriter->endElement();
// c:v
$xmlWriter->endElement();
// c:pt
$index++;
}
$xmlWriter->endElement();
// $itemLit
$xmlWriter->endElement();
// $itemType
}