Hi,
I wan to add different header to each section.In word you can add different header to each section if "Link to previouse" is disbled.
I wrote the following code in order to create different header for each section,but it only insert header for last section :
for ($i = 0; $i < 5; $i++) { if ($i !== 0) { $docx->addSection('nextPage', 'A4'); } $textOptions = array('fontSize' => 13, 'b' => 'on', 'color' => '567899',); $widthTableCols = array(700); $paramsTable = array('border' => 'nil', 'columnWidths' => $widthTableCols); $defaultHeader = 'defaultHeader' . $i; $default = 'default' . $i; $headerText = new WordFragment($docx, $defaultHeader); $headerText->addText('PHPDocX Header Title' . $i, $textOptions); $valuesTable = array(array(array('value' => $headerText, 'vAlign' => 'center'))); $headerTable = new WordFragment($docx, $defaultHeader); $headerTable->addTable($valuesTable, $paramsTable); $docx->addHeader(array($default => $headerTable)); $docx->addText('This document has a header'.$i); }
Any idea to add different header to each section?