Forum


Replies: 1   Views: 2570
Outline levels and cross references
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Brck  · 10-07-2018 - 16:09

Hi! 

First off, I have slightly modified the addCrossReference function to support other types of references than page references. For instance, I usually want to make a "full context" cross reference in which case the $url in the addCrossReference function is set to:

$url = 'REF ' . $options['referenceName'] . ' \w \h';

Now to my issue, I have three levels of headings in my word template (Heading 1, Heading 2 and Heading 3) which when used in the docx output looks like: 

1. Heading 1

1.1 Heading 2

1.1.1 Heading 3

If I add a bookmark to the text in Heading 3 and then set the referenceName to that bookmark, the cross reference is set to "1.1.1" in Word when I click "update fields" which is great. 

However, I sometimes include a custom list under a heading, such as: 

1.1 Heading 2

(A) some text (with bookmark on it)

(B) ...

The list is added with option 'outlineLvl' => 4. When I make a "full context" cross reference to the bookmark in (A) above, Word only displays (A) when I click "update field". I would like it to read 1.1(A) (as is the case if I - within Word - add a cross reference and select that list item in the "list items" view).

Is there any way to "connect" the headings and my sub-lists, so that the reference is automatically updated to for instance 1.2.5(B) when (B) under 1.2.5 is referenced?

Thanks in advance.

Best regards,

Brc