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

Using <br/> within <p> #1370

Closed
MikeLesaa opened this issue May 18, 2018 · 3 comments
Closed

Using <br/> within <p> #1370

MikeLesaa opened this issue May 18, 2018 · 3 comments

Comments

@MikeLesaa
Copy link

MikeLesaa commented May 18, 2018

 Hi!
When I use tab <br/> in html without other tags - it's ok. But if it is wrapped by p, in result br
is not replaced by line break in docx file.

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

        $html .= '<p>line1<br/>lin2</p>';

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

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

        $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
        $objWriter->save($fileName);

Context

  • PHP version: 5.4
  • PHPWord version: 0.14

Q: https://stackoverflow.com/questions/50409428/using-br-within-p

@troosan
Copy link
Contributor

troosan commented May 19, 2018

this was already fixed by #1277

@troosan troosan closed this as completed May 19, 2018
@MikeLesaa
Copy link
Author

@troosan I tried to use dev-develop version by composer but it does not work too. I saw that you change src/PhpWord/Reader/Word2007/AbstractPart.php file. But I tried read not doc-file, I tried to read html-file - I have error while converting from html to .docx file

@oleyur
Copy link

oleyur commented Jan 10, 2020

@troosan It was not fixed!!
br tag in p tag is not parsing now while we try read html and convert it to docx

@MikeLesaa did you found solution?

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

3 participants