【问题标题】:Repeat ListItem Numbering in PHPWORD在 PHPWORD 中重复 ListItem 编号
【发布时间】:2021-01-04 09:44:00
【问题描述】:

有没有办法重复 ListItem 编号(字母)?

PHPWORD 包

目前,输出为:

1. One
2. Two
   A. Alpha
   B. Beta
3. Three
   A. Charlie

我想输出这个:

1. One
2. Two
   A. Alpha
   B. Beta
2. Three
   A. Charlie

【问题讨论】:

    标签: php laravel phpword


    【解决方案1】:
    $multilevelList1 = 'multilevel list 1'; // Normal numbering style
    $multilevelList2 = 'multilevel list 2'; // Same style as previous one, but level 0 starts     at 2 instead of 1
    
    $phpWord->addNumberingStyle(
        $multilevelList1,
        array(
            'type'   => 'multilevel',
            'levels' => array(
                array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360, 
                      'start' => 1),
                array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' =>     360, 'tabPos' => 720),
            ),
        )
    );
    
    $phpWord->addNumberingStyle(
        $multilevelList2,
        array(
            'type'   => 'multilevel',
            'levels' => array(
                array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360,
                      'start' => 2),
                array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' =>     360, 'tabPos' => 720),
            ),
        )
    );
    
    
    // New section
    $section = $phpWord->addSection();
    
    // Lists
    $section->addListItem('One',     0, null, $multilevelList1);
    $section->addListItem('Two',     0, null, $multilevelList1);
    $section->addListItem('Alpha',   1, null, $multilevelList1);
    $section->addListItem('Beta',    1, null, $multilevelList1);
    $section->addListItem('Three',   0, null, $multilevelList2);
    $section->addListItem('Charlie', 1, null, $multilevelList2);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-18
      • 1970-01-01
      相关资源
      最近更新 更多