Replies: 2   Views: 919
Cross reference with no context
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 dev@ams  · 01-07-2020 - 06:59

Hi there,

When I make a cross reference to a heading with numbering, the produced docx seems to make a cross reference with full context (also including numberings of headings of higher levels). Is there a way to define a cross reference to take no context? Or otherwise: is there a macro to convert that?

Posted by admin  · 01-07-2020 - 07:41


phpdocx 10 added the modifiers option to addCrossReference (, so you can set a custom modifier when adding a cross-reference,  \h is the default one, but you can use others such as \w \h, \r \h, \n \h... (unfortunately there's no list with all available options)

We recommend you to generate the cross-reference using MS Word to get the exact modifier you want to use (for example extracting the DOCX and opening word/document.xml). If you open a support ticket ( with a DOCX sample of the output you want to get, and the dev team will generate a custom script.


Posted by dev@ams  · 01-07-2020 - 07:58

Thanks for the useful information! We will try some things out and make a support ticket if necessary.