You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am generating table of content, which worked perfectly on OpenOffice 7.2.7.2 and after update to 7.3.5 (but i think also prevous version) it generate correctly docx file, but when I click on "update table of content", all TOC is deleted (blank). In version 7.2.7.2 it is still working corretly in both version of phpword (0.17 and 0.18)
Describe the Bug
I am generating table of content, which worked perfectly on OpenOffice 7.2.7.2 and after update to 7.3.5 (but i think also prevous version) it generate correctly docx file, but when I click on "update table of content", all TOC is deleted (blank). In version 7.2.7.2 it is still working corretly in both version of phpword (0.17 and 0.18)
Steps to Reproduce
`<?php
require_once 'vendor/phpoffice/common/tests/bootstrap.php';
$filepath = "/opt/lampp/temp/testfile.docx";
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->getSettings()->setUpdateFields(true);
$section = $phpWord->addSection();
$footer = $section->addFooter();
$table = $footer->addTable();
$styleCellFooter =
[
'borderTopSize' => 10,
'align'=>'center'
];
$myFontStyleFooter=array('name' => 'ARIAL', 'size' => 9, 'color' => '1B2232', 'bold' => true,'align'=>'left');
$myFontStyle2Footer=array('name' => 'Times New Roman', 'size' => 9, 'color' => '1B2232', 'bold' => false,'align'=>'center');
$table->addRow();
$table->addRow();
$cell = $table->addCell(9013);
$textrun = $cell->addTextRun($myFontStyle2Footer);
$textrun->addText('report page number. ');
$textrun->addField('PAGE');
$textrun->addText(' from total pages ');
$textrun->addField('NUMPAGES');
$section->addText('Complete report',array('name' => 'Tahoma', 'size' => 12,'bold' => true),array('align'=>'center'));
$section->addText(
'',
array('name' => 'Tahoma', 'size' => 10,'bold' => true)
);
$section->addText(
'List of attachements ',
array('name' => 'Tahoma', 'size' => 10,'bold' => true)
);
////////////////////
$phpWord->getSettings()->setUpdateFields(true);
$phpWord->addNumberingStyle(
'hNum',
array(
'type' => 'multilevel',
'levels' => array(
array( 'pStyle' => 'Heading1', 'format' => 'none', 'suffix' => 'nothing', ),
array( 'pStyle' => 'Heading2', 'format' => 'none', 'suffix' => 'nothing', ),
array( 'pStyle' => 'Heading3', 'format' => 'none', 'suffix' => 'nothing', ),
)
)
);
$section->addTOC();
///////////////
$section->addTitle('Section', 1);
$section->addTitle('Section 2', 1);
$section->addTitle('Section 3', 1);
$section->addTitle('Section 3', 1);
$table ->addRow();
$cell = $table ->addCell(4500);
$cell -> addText('Date: '.date("d.m.Y", strtotime($datum_odberu)),
array('name' => 'Tahoma', 'size' => 10,'bold' => false));
$cell = $table ->addCell(4500);
// Saving the docuostatní OOXML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save($filepath);
header('Content-disposition: inline');
header('Content-type: application/msword');
readfile($filepath);
//exit;`
Context
Please fill in your environment information:
The text was updated successfully, but these errors were encountered: