本文整理匯總了PHP中PHPWord::getNumbering方法的典型用法代碼示例。如果您正苦於以下問題:PHP PHPWord::getNumbering方法的具體用法?PHP PHPWord::getNumbering怎麽用?PHP PHPWord::getNumbering使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHPWord
的用法示例。
在下文中一共展示了PHPWord::getNumbering方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: writeDocument
/**
*
* @param PHPWord $PHPWord
* @return string
*/
public function writeDocument(PHPWord $PHPWord = null)
{
$numbering = $PHPWord->getNumbering();
// Create XML writer
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
$objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_MEMORY);
}
// XML header
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
// START w:numbering
$objWriter->startElement('w:numbering');
$objWriter->writeAttribute('xmlns:ve', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
$objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
$objWriter->writeAttribute('xmlns:m', 'http://schemas.openxmlformats.org/officeDocument/2006/math');
$objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
$objWriter->writeAttribute('xmlns:wp', 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing');
$objWriter->writeAttribute('xmlns:w10', 'urn:schemas-microsoft-com:office:word');
$objWriter->writeAttribute('xmlns:w', 'http://schemas.openxmlformats.org/wordprocessingml/2006/main');
$objWriter->writeAttribute('xmlns:wne', 'http://schemas.microsoft.com/office/word/2006/wordml');
// Write all of the abstractNum elements
foreach ($numbering as $key => $value) {
$value->toXml($objWriter);
}
// Write all of the num elements
foreach ($numbering as $key => $value) {
$objWriter->startElement('w:num');
$objWriter->writeAttribute("w:numId", $key + 1);
$objWriter->startElement('w:abstractNumId');
$objWriter->writeAttribute("w:val", $key + 1);
$objWriter->endElement();
$objWriter->endElement();
}
// END w:numbering
$objWriter->endElement();
return $objWriter->getData();
}