How to display a text with the format 'bTEXTO / b' in word with PHPWord

0

My Code:

    <?php 
require_once '../PHPWord-master/src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();

use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Style\Font;

//Instancia phpWord.
$documento = new PhpWord();
// Nueva seccion
$seccion = $documento->addSection();
$documento->addTitleStyle(1, array('size' => 16), array('numStyle' => 'hNum', 'numLevel' => 0));
$seccion->addTitle('Heading 1', 1);
$header = $seccion->addHeader();
$footer = $seccion->addFooter();
$header->addText("PRUEBA HEADER");
$footer->addText("PRUEBA FOOTER");
$seccion->addText(
    '<b>PRUEBA</b> WORD PRUEBA WORDPRUEBA WORDPRUEBA WORD PRUEBA WORDPRUEBA WORDPRUEBA WORDPRUEBA WORDPRUEBA WORDPRUEBA WORD',
    array('name' => 'Tahoma', 'size' => 10)
);
//Guardando documento
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($documento, 'Word2007');
$xmlWriter->save('Documento01.docx');

header("Content-Disposition: attachment; filename='Documento01.docx'");
echo file_get_contents('Documento01.docx');

?>

It generates the file .docx but it does not show me the text, I get the error xml parsing error

    
asked by arglez35 19.10.2018 в 00:43
source

0 answers