Export to Word - Add Header

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Trosmada
User
Posts: 17

Export to Word - Add Header

Post 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


mobhar
User
Posts: 11790

Post 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.


Trosmada
User
Posts: 17

Post 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


Trosmada
User
Posts: 17

Post 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


mobhar
User
Posts: 11790

Post 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.


arbei
User
Posts: 9501

Post 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.


Trosmada
User
Posts: 17

Post by Trosmada »

Thank you for the explanation. Blessings


Post Reply