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


PHP PhpWord::getSections方法代码示例

本文整理汇总了PHP中PhpOffice\PhpWord\PhpWord::getSections方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpWord::getSections方法的具体用法?PHP PhpWord::getSections怎么用?PHP PhpWord::getSections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpOffice\PhpWord\PhpWord的用法示例。


在下文中一共展示了PhpWord::getSections方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAutoStyles

 /**
  * Get automatic styles.
  *
  * @param \PhpOffice\PhpWord\PhpWord $phpWord
  * @return void
  */
 private function getAutoStyles(PhpWord $phpWord)
 {
     $sections = $phpWord->getSections();
     $paragraphStyleCount = 0;
     $fontStyleCount = 0;
     foreach ($sections as $section) {
         $style = $section->getStyle();
         $style->setStyleName("Section{$section->getSectionId()}");
         $this->autoStyles['Section'][] = $style;
         $this->getContainerStyle($section, $paragraphStyleCount, $fontStyleCount);
     }
 }
开发者ID:Senasum,项目名称:PHPWord,代码行数:18,代码来源:Content.php

示例2: testCreateGetSections

 /**
  * Test create/get section
  */
 public function testCreateGetSections()
 {
     $phpWord = new PhpWord();
     $phpWord->addSection();
     $this->assertCount(1, $phpWord->getSections());
 }
开发者ID:HaiLeader,项目名称:quizz,代码行数:9,代码来源:PhpWordTest.php

示例3: getAutomaticStyles

 /**
  * Set automatic styles
  */
 private function getAutomaticStyles(PhpWord $phpWord)
 {
     $sections = $phpWord->getSections();
     $sectionCount = count($sections);
     if ($sectionCount > 0) {
         $paragraphStyleCount = 0;
         $fontStyleCount = 0;
         foreach ($sections as $section) {
             $elements = $section->getElements();
             foreach ($elements as $element) {
                 if ($element instanceof Text) {
                     $fontStyle = $element->getFontStyle();
                     $paragraphStyle = $element->getParagraphStyle();
                     // Font
                     if ($fontStyle instanceof Font) {
                         $fontStyleCount++;
                         $arrStyle = array('color' => $fontStyle->getColor(), 'name' => $fontStyle->getName());
                         $phpWord->addFontStyle('T' . $fontStyleCount, $arrStyle);
                         $element->setFontStyle('T' . $fontStyleCount);
                         // Paragraph
                     } elseif ($paragraphStyle instanceof Paragraph) {
                         $paragraphStyleCount++;
                         $phpWord->addParagraphStyle('P' . $paragraphStyleCount, array());
                         $element->setParagraphStyle('P' . $paragraphStyleCount);
                     }
                 }
             }
         }
     }
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:33,代码来源:Content.php

示例4: testCreateGetSections

 /**
  * Test create/get section
  */
 public function testCreateGetSections()
 {
     $phpWord = new PhpWord();
     $this->assertEquals(new Section(1), $phpWord->addSection());
     $phpWord->addSection();
     $this->assertEquals(2, count($phpWord->getSections()));
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:10,代码来源:PhpWordTest.php


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