Open

Description
This is:
- a feature request
- a bug report
- not a usage question (ask them on https://stackoverflow.com/questions/tagged/phpword)
Expected Behavior
I output static text from the controller, phpword should convert it into a .docx
file with the h1
formatted, but it doesn't
$content = "<h1>Lorem Test</h1>is simply dummy text of the printing and typesetting industry is simply" . "<br/>" . "dummy text of the printing and typesetting industry. generated from the controller";
This is my full tmce
method in my controller.
$content = "<h1>Lorem Test</h1>is simply dummy text of the printing and typesetting industry is simply" . "<br/>" . "dummy text of the printing and typesetting industry. generated from the controller";
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addText(
strip_tags($content),
array('name' => 'Tahoma', 'size' => 13, 'color' => '#FF0044', 'bold' => true)
);
\PhpOffice\PhpWord\Shared\Html::addHtml($section, "<html><head><style type=\"text/css\">h1{font-size: 48pt;font-weight: bold;color: #f00;}</style></head><body>$content</body></html>", true, true);
header('Content-Type: application/msword');
// header('Content-Disposition: attachement;filename="test.docx"');
header("Content-disposition: attachment; filename=" . date("Y-m-d") . ".docx");
$objectWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objectWriter->save('php://output');
return view('tinymce.tinymce', compact('content'));
I don't know if there's any option I need to activate I'm not aware of.
Current Behavior
What is the current behavior?
Failure Information
Please help provide information about the failure.
Context
- PHP version: 7.3.3
- PHPWord version: 0.16
- Laravel 5.8
Metadata
Metadata
Assignees
Labels
No labels