Forum


Replies: 1   Views: 2358
Addcrossreference() undocumented (cool) behavior
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 FGI  · 19-10-2017 - 13:16

Wondering for a while of how to apply some styling on cross-reference generated by addCrossReference(), I discovered that adding some options like 'bold' => 'true', 'color' => '#FF0000' actually worked!

But this is not documented in your API:
https://www.phpdocx.com/api-documentation/word-content/add-cross-reference-Word-document-with-PHP

Working example:

$wf->addCrossReference($refTitle, [
         'type'             => 'bookmark',
         'referenceName'    => $refTitle,
         'bold'             => true,
         'color'            => '#00FF00'
]);

You should indicate this on your API as it is really useful :)

 

Best regards,

 

 

Posted by admin  · 20-10-2017 - 06:29

Hello,

The addCrossReference method uses addText to generate the text content so almost all properties of this method are supported. As you say, this should be added on the API page, we'll include this information in short.

Regards.