This project is read-only.

Internal links

Apr 22, 2013 at 2:23 PM
Edited Apr 22, 2013 at 8:30 PM
Hello,

I'm writing a tool in PHP to create a documentation with the help of PHPWord. But I can't figure out how to link inside the word document. I know that it is possible in the docx format and PHPWord seems to be able to create external links. But how can create an internal link?

Best regards,
TrustSeg
Apr 22, 2013 at 8:29 PM
Ok, it seems that I can set bookmarks with addTitle() and get the (automatically generated?) name with getAnchor(). In a natively generated word document (saved directly with Word) the <w:hyperlink> nodes contain the attribute "w:anchor" which stores the name of the bookmark node. But I found no way to set this attribute through PHPWord. I tried to create a link with:

$section->addLink("_Toc252634155", "Title 3");

.. but this didn't work. PHPWord stores the target somewhere else but not in the file word\document.xml in the "w:anchor" attribute. Does anyone have an idea? Please help.