-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Milestone
Description
Describe the Bug
There is a bug in the phpword while transforming HTML to a Word document and it doesn’t recognize text-align: right. So we need to edit this file vendor/phpoffice/phpword/src/PhpWord/SimpleType/Jc.php and set const END = 'right'; instead of const END = 'end'; before running the transforming process.
Steps to Reproduce
Here is an example of HTML code :
<p style="text-align:justify;"><strong>Poursuivre la gestion sur un compte dédié.</strong></p>
<p style="text-align:right;"><strong>Poursuivre la gestion sur un compte dédié.</strong></p>
<p style="text-align:right;">Frais de gestion de <strong>xx euros / mois HT</strong> facturés par Auto-planning.</p>
And php code:
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $ourHtmlCode, false, false);
$docFileName = "docFileNaame";
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord);
$objWriter->save('/somePath/'. $docFileName);
$localDocFilePath = $tempPath . $docFileName;
$docContent = $this->apiStorage->read($localDocFilePath);
$this->apiStorage->delete($localDocFilePath);
return $this->googleDriveStorage->write(
'googleDiskFolderId',
$docContent,
[
'name' => $docFileName,
'mimeType' => 'application/vnd.google-apps.document'
]
);
Current Behavior
When I transform HTML code with align right to word doc. I do not have alignment in that place (For other align it works well)
Context
- PHP Version: 7.2
- PHPWord Version: dev-master