Forum


Replies: 2   Views: 2364
Template list with html content
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 royh  · 28-06-2018 - 17:16

Good day,

I have the following template:

6    HEADING

6.1 $HEADING_CONTENTS$

I wonder if it is possible to use replaceListVariable where I can produce the document below. The sub-headings will be automated and incremented and the contents will come from a WYSIWYG HTML field. Will WordFragments work with HTML? I can't seem to find documentation on if and how WordFragments handle HTML and if this is possible.

6    HEADING

6.1 SUB-HEADING 1

  1.     Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    1.     Page 4: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
      1.    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
      2.    Lorem ipsum dolor sit amet, consectetur adipiscing elit.

6.2 SUB-HEADING 2

a)    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
b)    Lorem ipsum dolor sit amet, consectetur adipiscing elit.

 

Posted by admin  · 29-06-2018 - 07:12

Deleted by admin · 29-06-2018 - 07:29

Posted by admin  · 29-06-2018 - 07:13

Hello,

HTML can be transformed to Word as a WordFragment, just as almost any other content, to be added to documents.

We think you have three approaches to accomplish what you need:

· Use the wordStyles option available when importing HTML. On https://www.phpdocx.com/documentation/introduction/html-to-word-PHP you can check some samples about how to use this option.

· Clone the heading as many times as needed (https://www.phpdocx.com/api-documentation/docx-path/clone-elements-in-docx) and add the HTML as WordFragment (https://www.phpdocx.com/documentation/practical/wordfragments-and-wordml) using DOCXPath (https://www.phpdocx.com/api-documentation/docx-path/insert-elements-in-docx) or a custom placeholder.

· Add the content and use DOCXCustomizer (https://www.phpdocx.com/documentation/introduction/docxcustomizer) to set the heading styles to the strings you need. This feature is only available in Premium licenses.

Regards.