Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align: justify and bold breaks line instead of inline bold #1330

Closed
1 of 2 tasks
eelco2k opened this issue Apr 3, 2018 · 4 comments
Closed
1 of 2 tasks

Align: justify and bold breaks line instead of inline bold #1330

eelco2k opened this issue Apr 3, 2018 · 4 comments

Comments

@eelco2k
Copy link

eelco2k commented Apr 3, 2018

This is:

  • a bug report
  • a feature request

Expected Behavior

<p>This is some long <b>bold text which should automatic split and go to next line</b> when align is set to 'justify', but it doesn't and this last part goes to third line.

Current Behavior

The bold part (also when using <b> ...</b>) will be put on a new line instead of inline in the text.

How to Reproduce

<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();

$html = "This medical follow-up training commits itself to one <b>basic level 'efficiency of care'</b> to strive for every medical specialist where efficiency is part of daily work "; //example text

\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html , false, false);

// Saving the document as OOXML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');

Context

  • PHP version: 7.1
  • PHPWord version: 0.14
@eelco2k
Copy link
Author

eelco2k commented Apr 3, 2018

Looks like it's same behavior as this problem: #1252
Should it be fixed in 0.15??

@troosan
Copy link
Contributor

troosan commented Apr 3, 2018

if you surround it with <p>...</p> its working fine

@eelco2k
Copy link
Author

eelco2k commented Apr 3, 2018

Perfect it works. Noticed you replied this fix also in other thread ;-) so i could try it out. Thanks for fast reply!

@eelco2k eelco2k closed this as completed Apr 3, 2018
@troosan
Copy link
Contributor

troosan commented Apr 3, 2018

you're welcome. Other solution, if you cannot modify the HTML, you can first add add a TextRun to the section, then add the HTML to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants