本文整理汇总了PHP中PhpOffice\PhpWord\Shared\XMLWriter::writeElementBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::writeElementBlock方法的具体用法?PHP XMLWriter::writeElementBlock怎么用?PHP XMLWriter::writeElementBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpOffice\PhpWord\Shared\XMLWriter
的用法示例。
在下文中一共展示了XMLWriter::writeElementBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeAxis
/**
* Write axis
*
* @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param string $type
* @return void
*/
private function writeAxis(XMLWriter $xmlWriter, $type)
{
$types = array('cat' => array('c:catAx', 1, 'b', 2), 'val' => array('c:valAx', 2, 'l', 1));
list($axisType, $axisId, $axisPos, $axisCross) = $types[$type];
$xmlWriter->startElement($axisType);
$xmlWriter->writeElementBlock('c:axId', 'val', $axisId);
$xmlWriter->writeElementBlock('c:axPos', 'val', $axisPos);
$xmlWriter->writeElementBlock('c:crossAx', 'val', $axisCross);
$xmlWriter->writeElementBlock('c:auto', 'val', 1);
if (isset($this->options['axes'])) {
$xmlWriter->writeElementBlock('c:delete', 'val', 0);
$xmlWriter->writeElementBlock('c:majorTickMark', 'val', 'none');
$xmlWriter->writeElementBlock('c:minorTickMark', 'val', 'none');
$xmlWriter->writeElementBlock('c:tickLblPos', 'val', 'none');
// nextTo
$xmlWriter->writeElementBlock('c:crosses', 'val', 'autoZero');
}
if (isset($this->options['radar'])) {
$xmlWriter->writeElement('c:majorGridlines');
}
$xmlWriter->startElement('c:scaling');
$xmlWriter->writeElementBlock('c:orientation', 'val', 'minMax');
$xmlWriter->endElement();
// c:scaling
$this->writeShape($xmlWriter, true);
$xmlWriter->endElement();
// $axisType
}
示例2: writeDropDown
/**
* Write dropdown.
*
* @link http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\FormField $element
* @return void
*/
private function writeDropDown(XMLWriter $xmlWriter, FormFieldElement $element)
{
$default = $element->getDefault();
$value = $element->getValue();
if ($value == null) {
$value = $default;
}
$entries = $element->getEntries();
$xmlWriter->startElement('w:ddList');
$xmlWriter->writeElementBlock('w:result', 'w:val', $value);
$xmlWriter->writeElementBlock('w:default', 'w:val', $default);
foreach ($entries as $entry) {
$xmlWriter->writeElementBlock('w:listEntry', 'w:val', $entry);
}
$xmlWriter->endElement();
}
示例3: writeDate
/**
* Write date.
*
* @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
* @param \PhpOffice\PhpWord\Element\SDT $element
* @return void
*/
private function writeDate(XMLWriter $xmlWriter, SDTElement $element)
{
$type = $element->getType();
$xmlWriter->startElement("w:{$type}");
$xmlWriter->writeElementBlock('w:dateFormat', 'w:val', 'd/M/yyyy');
$xmlWriter->writeElementBlock('w:lid', 'w:val', 'en-US');
$xmlWriter->writeElementBlock('w:storeMappedDataAs', 'w:val', 'dateTime');
$xmlWriter->writeElementBlock('w:calendar', 'w:val', 'gregorian');
$xmlWriter->endElement();
// w:date
}