Headers until the 2nd Page?

Feb 13, 2011 at 3:40 PM

Hello!

How do I get the header only from the 2nd page?


derSESO 

Feb 28, 2011 at 2:15 PM

create a separate section for the first page and do not include header in that.

create a different section for the rest of pages.. 

Mar 11, 2011 at 10:26 AM

Hi!

//-- Page 1 --
$section = $PHPWord->createSection($styleSeite);
...

//-- Page 2 --
$section = $PHPWord->createSection($styleSeite);
...
$header = $section->createHeader();
$header->addPreserveText('Seite {PAGE} von {NUMPAGES} - Angebot Nr. {FILENAME} vom {SAVEDATE \@ "dd.MM.yyyy"}', $styleTextHeader);

$footer = $section->createFooter();
$footer->addText('DIN ISO 9001 Certified . Tel. +49 (0)89 / ...', $styleTextFooter, $paraTextFooter); 

The document is created, but the opener is an error:

"The file is damaged and can not be opened.
Position: component: /word/document.xml, Line: 3345, Column: 0"

Jul 6, 2011 at 2:51 PM

To avoid that error, try adding a header/footer in the first page too.

 

Jun 14, 2014 at 5:39 PM
Hello!

What if the content on the first page is such that I don't know what point in the content will spill over to the second page? Sometimes I won't have a second page, other times it could be up to 6 pages long. I only want the header information on the 2nd and onward pages.

Thanks.
Jun 17, 2014 at 9:39 AM
Hi. The development of PHPWord is continued on GitHub. The latest stable version of PHPWord (0.11) has been able to create header/footer only on the first page. See Sample_12_HeaderFooter.php. Thanks.