使用PHPWord自定义索引

Background

I'm going to generate document index something like below.

enter image description here

I tried with PHPWord which is written by Troosan, by the way still didn't get the expected result.

What I did

Using PHPWord, I generated page numbers like this. (Step 1)

A SERIES OF UNFORTUNATE EVENTS, SEASON 3 ................6
GUESS WHO DIED ..........................................8
VALLEY OF THE BOOM ......................................10
AMERICAN VANDAL, SEASON 2 ...............................11
RUSSIAN DOLL ............................................12
THE OA, SEASON 2 ........................................13
...

As you can see I generated the page numbers, by the way WHAT I WANT is how can I add the Chapter name between the title without page number? So it should look like this (Step 2)

ABC
GUESS WHO DIED ..........................................8
VALLEY OF THE BOOM ......................................10
AMERICAN VANDAL, SEASON 2 ...............................11

ABC Studios
RUSSIAN DOLL ............................................12
THE OA, SEASON 2 ........................................13
...

Can I archieve (Step 2) using PHPWord? If not then what is your suggestion?

You can partially achieve this with the following: First create a XE fields (index fields) as follows

$textrun->addField('XE', array(), array(), 'Entry text');

In this case, 'Entry text' can also be a TextRun, which allows you to format the text.

Once you have created index entry fields, you can create the actual index:

$section->addField('INDEX', array(), array('\\e "   " \\h "A" \\c "3"'));

The different options you can pass are described here: https://support.office.com/en-us/article/Field-codes-Index-field-adafcf4a-cb30-43f6-85c7-743da1635d9e?ui=en-US&rs=en-US&ad=US

Of course this is only a partial solution as it will split the index by first letter, but you will not have the subdivision by Network (in you UC).

If you manage to implement this in Word, it should be possible to do the same in PHPWord.