当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPWord::getNumbering方法代码示例

本文整理汇总了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();
 }
开发者ID:frankkoch,项目名称:moodle-mod_offlinequiz,代码行数:44,代码来源:Numbering.php


注:本文中的PHPWord::getNumbering方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。