Page 1 of 1
Export to Word - Add Header
Posted: Thu May 23, 2024 7:28 pm
by Trosmada
Dear friends,
Kindly help.
I only want to add Header when export to word.
function Page_Exporting(&$doc)
{
if ($this->isExport("word")) {
$doc->Text = '<p class="ew-export">Warehouse List</p>';
}
return true; // Return true to use default export and skip Row_Export event
}
And when I click export to word --- there is still no header.
Thanks in advanced
Re: Export to Word - Add Header
Posted: Thu May 23, 2024 8:33 pm
by mobhar
Which PHPMaker vesion are you using?
I have just tested by using PHPMaker v2024, and it works properly. Make sure you did not enable PHPWord extension from Tools -> Extensions before re-generating ALL the script files again.
Re: Export to Word - Add Header
Posted: Fri May 24, 2024 8:45 pm
by Trosmada
Thanks for reply.
I am using v2024.11
and already Enabled -- Extensions - PHPWord
also Generate all Scripts
I don't know why, there is still no header.
Is there anything else to set or to add ? kindly help.
thanks a lot
Re: Export to Word - Add Header
Posted: Fri May 24, 2024 9:35 pm
by Trosmada
I just tried again that statement in demo, table shippers, it's work !!
surprisingly it's uncheck on the extension phpword.. but it's work
Then I uncheck phpword extension on my program.. then it's work !
Please advise.. why it's work without check on phpword extension.
Thank you
Re: Export to Word - Add Header
Posted: Fri May 24, 2024 11:05 pm
by mobhar
I am not sure. I tested yesterday without using the Extension, and it worked. But if I enabled the Extension, then it did not work.
Re: Export to Word - Add Header
Posted: Sat May 25, 2024 11:14 am
by arbei
If you turn off the PHPWord extension, export is done by letting MS Word imports the HTML, but you have no control.
PHPWord cannot parse HTML, so for normal tables the export is done by exporting field by field and adding the data cell by cell using OOXML (so the ExportWord class can have full control on each field and you can customize by overriding the methods). For reports, since the data is not tabular due to grouping and summaries, the PHPWord extension just read the HTML and build the content.
To add extra content with PHPWord extension, see Customizing Export.
Re: Export to Word - Add Header
Posted: Sat May 25, 2024 1:33 pm
by Trosmada
Thank you for the explanation. Blessings