Forum


Replies: 5   Views: 3397
Addcrossreference on wordfragment
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 AndrewCooper  · 17-06-2016 - 06:45

That's good news.  I'm glad I'm doing something wrong. I figured it made sense to be able to add cross references on fragments.

I'm using 5.5 trial at the moment.  I believe we are about to purchase the Corporate version of 6.0. Waiting on the final approval for that.

Here's my whole php file.

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once 'phpdocx/classes/CreateDocx.inc';

$docx = new CreateDocx();

$docx->addText("Blargity blarg-blarg blarg.");

$xref = new WordFragment($docx);
$xref->addCrossReference("blah", array("type" => "bookmark", "referenceName" => "blah"));
$docx->addText($xref);

$docx->createDocx('document');
echo "<a href='document.docx'>Document</a>";

And here is the error message I'm getting on the server.

[Fri Jun 17 08:42:13.892890 2016] [:error] [pid 2082] [client 192.168.56.100:61678] PHP Fatal error:  Call to undefined method WordFragment::addCrossReference() in /webdevroot/Test/DocGen/sandbox.php on line 11

Am I missing something here?

Thanks,

Andrew