Forum


Replies: 7   Views: 545
Generate word document with headings to be copied and pasted in google docs
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 joegraisbery  · 09-01-2023 - 09:25

hi

i created word file custom_template.docx in microsoft word and upload that in server and performed bellow code

$docx = new CreateDocxFromTemplate('custom_template.docx');

$wordStyles = array('<h1>' => 'Heading1' , '<h2>' => 'Heading2');
$html = '
    <h1>Heading 1</h1>
    <h2>Heading 2</h2>
';
$docx->embedHTML($html, array('wordStyles' => $wordStyles));

still it's not working i also tried below code

$docx = new CreateDocx();
$docx->importStyles('custom_template.docx', 'merge');

$wordStyles = array('<h1>' => 'Heading1' , '<h2>' => 'Heading2');
$html = '
    <h1>Heading 1</h1>
    <h2>Heading 2</h2>
';
$docx->embedHTML($html, array('wordStyles' => $wordStyles));