Forum


Replies: 3   Views: 739
Table of content not displayed during transform from word to html
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 jonas1919  · 06-11-2020 - 03:04

I used this code snippet to tranform from msword to html it's perfectly working but not displayed table of contents

$transformHTMLPlugin = new Phpdocx\Transform\TransformDocAdvHTMLDefaultPlugin();

$transform = new Phpdocx\Transform\TransformDocAdvHTML('example_transformDocAdvHTML_1.docx');

$html = $transform->transform($transformHTMLPlugin);

echo $html;

but It displays the table of content like this 

Table of Contents TOC \o "1-3" \h \z \u 1.Drupal PAGEREF _Toc55492644 \h 11.1.Drupal 7 PAGEREF _Toc55492645 \h 11.1.1.Yonas PAGEREF _Toc55492646 \h 12.Joomla PAGEREF _Toc55492647 \h 22.1Jomla 8 PAGEREF _Toc55492648 \h 2Joomla a PAGEREF _Toc55492649 \h 2WordPress PAGEREF _Toc55492650 \h 3Xxx PAGEREF _Toc55492651 \h 4

Is there any seggession. Thanks

Posted by admin  · 06-11-2020 - 06:59

Hello,

The current version of Word to HTML doesn't support transforming the TOC. On https://www.phpdocx.com/documentation/introduction/word-to-html-PHP you can read the supported contents and styles and how they are transformed. Instead of TOC we recommend you using links with bookmarks or cross-reference contents.

Using the conversion plugin based on libreoffice or msword (https://www.phpdocx.com/documentation/conversion-plugin) you can generate the TOC contents and then transform the DOCX output to HTML with TransformDocAdvHTML.

Regards.

Posted by jonas1919  · 09-11-2020 - 02:58

base on your seggestion I did it like-> my OS is linux and use LibreOffice then enable on config/phpdocxconfig.ini

method = "libreoffice"

path = "/opt/libreoffice/program/soffice"

but not working still is there another options

Posted by admin  · 09-11-2020 - 07:48

Hello,

To update TOCs in DOCX documents, you need to use the conversion plugin based on LibreOffice or MS Word. To use the LibreOffice one, please check the docs folder included in the package, you need to add an use a macro.

Regards.