PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

Problem to move from HTML editor (WYSIWYG) a word

Open montes2012 opened this issue 10 years ago • 13 comments

I have trouble going from HTML editor (WYSIWYG) to word possible what I want?

I'm trying Sample_26_Html.php Decompose Shared \ html and has no support for "
" "" </ span>


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

montes2012 avatar Jun 03 '14 01:06 montes2012

Yes. We can't parse <span> right now. PHPWord's HTML parser is quite new (#231), so we're going to put this as a to do. If you have time, you can tweak the code and submit to us as pull request. Thanks.

ivanlanin avatar Jun 03 '14 02:06 ivanlanin

there are also problems with br

montes2012 avatar Jun 03 '14 02:06 montes2012

I am also seeing formating problems with the HTML importer. If I have some extra time I might pick up some of this work. I have also submitted a patch for the HTML importer where it wasnt working for me at all under PHP 5.3. See #270

hskrtich avatar Jun 09 '14 21:06 hskrtich

I should also note that I have been having good success in using htmltodocx (https://htmltodocx.codeplex.com) instead of the built in HTML importer. It produces better results and only requires minor tweaks to get working with the latest version of PHPWord (name space stuff)

hskrtich avatar Jun 09 '14 21:06 hskrtich

I am working with laravel 4.1, install following the steps https://github.com/PHPOffice/PHPWord, as I can use (https://htmltodocx.codeplex.com/) Might give me a small example?

montes2012 avatar Jun 10 '14 03:06 montes2012

I will see if I can whip something up when I get in to the office tomorrow.

hskrtich avatar Jun 11 '14 02:06 hskrtich

I would greatly appreciate it

montes2012 avatar Jun 11 '14 02:06 montes2012

Ok here is an example a threw together, It isn't tested but you should get the gist. hah

https://gist.github.com/bskrtich/6c3cec68eacd3fb3012e

hskrtich avatar Jun 11 '14 14:06 hskrtich

Nice. Thanks @bskrtich . So, shall we "adopt" htmltodocx like we adopt PclZip?

ivanlanin avatar Jun 11 '14 18:06 ivanlanin

Thank you @bskrtich for your proof of concept work. It's great to see, and be able to see, the development of PHPWord and the use of pre-existing and stable projects. :smile:

andrew-kzoo avatar Jun 11 '14 18:06 andrew-kzoo

@ivanlanin Normally, with the HTML Reader we should export a DOCX equivalent. No ?

Progi1984 avatar Jun 11 '14 19:06 Progi1984

@Progi1984 What I was thinking is to adopt some algorithm of htmltodocx into our infant HTML Reader.

ivanlanin avatar Jun 12 '14 03:06 ivanlanin

It would be nice to be able to pull in some code form this project to beef up the HTML reader.

hskrtich avatar Jun 13 '14 15:06 hskrtich