Forum


Replies: 2   Views: 116
Cross reference with no context

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

Hello,

phpdocx 10 added the modifiers option to addCrossReference (https://www.phpdocx.com/api-documentation/word-content/add-cross-reference-Word-document-with-PHP), 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 (https://www.phpdocx.com/support) with a DOCX sample of the output you want to get, and the dev team will generate a custom script.

Regards.

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.