PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.28k stars 2.7k forks source link

Issue with detecting justify alignment in converting DOCX to HTML #2520

Open mdabagh opened 11 months ago

mdabagh commented 11 months ago

Dear developers,

I am currently using the PhpWord library to convert a DOCX file to HTML format using the following code:

$Content = IOFactory::load(public_path('test.docx'));
$writer = new \PhpOffice\PhpWord\Writer\HTML($Content);
$contentHtml = $writer->getContent();
dd($contentHtml);

However, I noticed that the above code does not properly detect paragraphs with justify alignment. It only sets the text-align property to left or right in the converted HTML. I believe the issue lies in the handling of text alignment during the conversion process.

I would like to request assistance in resolving this issue or guidance on any possible workarounds. Please let me know if any additional details or examples are required.

Thank you for your support and for developing the PhpWord library.

oleibman commented 11 months ago

Using a simple doc of my own, I see <p style="text-align: justify; ... in the Html output. Do you not see the same? If you don't, can you upload a file that demonstrates the problem?

Progi1984 commented 3 months ago

@mdabagh Hi have you got a sample file please ?