Esempio n. 1
0
 /**
  * Adds a numbering style
  *
  * @param string $styleName
  * @param mixed $styles
  * @return \PhpOffice\PhpWord\Style\Numbering
  */
 public function addNumberingStyle($styleName, $styles)
 {
     return Style::addNumberingStyle($styleName, $styles);
 }
Esempio n. 2
0
 /**
  * Get legacy numbering definition
  *
  * @return array
  * @since 0.10.0
  */
 private function getListTypeStyle()
 {
     // Check if legacy style already registered in global Style collection
     $numStyle = "PHPWordList{$this->listType}";
     if (Style::getStyle($numStyle) !== null) {
         $this->setNumStyle($numStyle);
         return;
     }
     // Property mapping for numbering level information
     $properties = array('start', 'format', 'text', 'alignment', 'tabPos', 'left', 'hanging', 'font', 'hint');
     // Legacy level information
     $listTypeStyles = array(self::TYPE_SQUARE_FILLED => array('type' => 'hybridMultilevel', 'levels' => array(0 => '1, bullet, , left, 720, 720, 360, Wingdings, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', 2 => '1, bullet, , left, 2160, 2160, 360, Wingdings, default', 3 => '1, bullet, , left, 2880, 2880, 360, Symbol, default', 4 => '1, bullet, o, left, 3600, 3600, 360, Courier New, default', 5 => '1, bullet, , left, 4320, 4320, 360, Wingdings, default', 6 => '1, bullet, , left, 5040, 5040, 360, Symbol, default', 7 => '1, bullet, o, left, 5760, 5760, 360, Courier New, default', 8 => '1, bullet, , left, 6480, 6480, 360, Wingdings, default')), self::TYPE_BULLET_FILLED => array('type' => 'hybridMultilevel', 'levels' => array(0 => '1, bullet, , left, 720, 720, 360, Symbol, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', 2 => '1, bullet, , left, 2160, 2160, 360, Wingdings, default', 3 => '1, bullet, , left, 2880, 2880, 360, Symbol, default', 4 => '1, bullet, o, left, 3600, 3600, 360, Courier New, default', 5 => '1, bullet, , left, 4320, 4320, 360, Wingdings, default', 6 => '1, bullet, , left, 5040, 5040, 360, Symbol, default', 7 => '1, bullet, o, left, 5760, 5760, 360, Courier New, default', 8 => '1, bullet, , left, 6480, 6480, 360, Wingdings, default')), self::TYPE_BULLET_EMPTY => array('type' => 'hybridMultilevel', 'levels' => array(0 => '1, bullet, o, left, 720, 720, 360, Courier New, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', 2 => '1, bullet, , left, 2160, 2160, 360, Wingdings, default', 3 => '1, bullet, , left, 2880, 2880, 360, Symbol, default', 4 => '1, bullet, o, left, 3600, 3600, 360, Courier New, default', 5 => '1, bullet, , left, 4320, 4320, 360, Wingdings, default', 6 => '1, bullet, , left, 5040, 5040, 360, Symbol, default', 7 => '1, bullet, o, left, 5760, 5760, 360, Courier New, default', 8 => '1, bullet, , left, 6480, 6480, 360, Wingdings, default')), self::TYPE_NUMBER => array('type' => 'hybridMultilevel', 'levels' => array(0 => '1, decimal, %1., left, 720, 720, 360, , default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', 2 => '1, bullet, , left, 2160, 2160, 360, Wingdings, default', 3 => '1, bullet, , left, 2880, 2880, 360, Symbol, default', 4 => '1, bullet, o, left, 3600, 3600, 360, Courier New, default', 5 => '1, bullet, , left, 4320, 4320, 360, Wingdings, default', 6 => '1, bullet, , left, 5040, 5040, 360, Symbol, default', 7 => '1, bullet, o, left, 5760, 5760, 360, Courier New, default', 8 => '1, bullet, , left, 6480, 6480, 360, Wingdings, default')), self::TYPE_NUMBER_NESTED => array('type' => 'multilevel', 'levels' => array(0 => '1, decimal, %1., left, 360, 360, 360, , ', 1 => '1, decimal, %1.%2., left, 792, 792, 432, , ', 2 => '1, decimal, %1.%2.%3., left, 1224, 1224, 504, , ', 3 => '1, decimal, %1.%2.%3.%4., left, 1800, 1728, 648, , ', 4 => '1, decimal, %1.%2.%3.%4.%5., left, 2520, 2232, 792, , ', 5 => '1, decimal, %1.%2.%3.%4.%5.%6., left, 2880, 2736, 936, , ', 6 => '1, decimal, %1.%2.%3.%4.%5.%6.%7., left, 3600, 3240, 1080, , ', 7 => '1, decimal, %1.%2.%3.%4.%5.%6.%7.%8., left, 3960, 3744, 1224, , ', 8 => '1, decimal, %1.%2.%3.%4.%5.%6.%7.%8.%9., left, 4680, 4320, 1440, , ')), self::TYPE_ALPHANUM => array('type' => 'multilevel', 'levels' => array(0 => '1, decimal, %1., left, 720, 720, 360, , ', 1 => '1, lowerLetter, %2., left, 1440, 1440, 360, , ', 2 => '1, lowerRoman, %3., right, 2160, 2160, 180, , ', 3 => '1, decimal, %4., left, 2880, 2880, 360, , ', 4 => '1, lowerLetter, %5., left, 3600, 3600, 360, , ', 5 => '1, lowerRoman, %6., right, 4320, 4320, 180, , ', 6 => '1, decimal, %7., left, 5040, 5040, 360, , ', 7 => '1, lowerLetter, %8., left, 5760, 5760, 360, , ', 8 => '1, lowerRoman, %9., right, 6480, 6480, 180, , ')));
     // Populate style and register to global Style register
     $style = $listTypeStyles[$this->listType];
     foreach ($style['levels'] as $key => $value) {
         $level = array();
         $levelProperties = explode(', ', $value);
         $level['level'] = $key;
         for ($i = 0; $i < count($properties); $i++) {
             $property = $properties[$i];
             $level[$property] = $levelProperties[$i];
         }
         $style['levels'][$key] = $level;
     }
     Style::addNumberingStyle($numStyle, $style);
     $this->setNumStyle($numStyle);
 }