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

HTML, putting a tag into a list item line causes list item text to disappear when writing to docx. Where can I find? #626

Closed
WriterStat opened this issue Sep 24, 2015 · 4 comments

Comments

@WriterStat
Copy link

WriterStat commented Sep 24, 2015

Hi reading in a html string with a tag in a list item <li> causes the text in that list item to disappear.

Instead of applying that tag to the list item text, such as bold or strong <strong>.

Unexpected error.

Not asking for a fix, just for a pointer or a leg up to where that might be handled in the code base, where I might look for it, so I can fix it.

I've added <b> and a few other things to HTML.php. Lists work fine, it just doesn't seem to like tags in them. I'd like to update them.

Thanks!

Cheers,

-C


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

@Yrutan
Copy link

Yrutan commented Nov 27, 2015

I seems to be having the same problem. When I save a text from a web page to a Word document the items of a list with an additional tag are not read/saved.

Just to be sure it wasn't how I used it, I confirmed by changing the Sample_30_ReadHTML.php to include the situation and it does exactly what is described.

Any idea of what is causing it to do that ?
Or of what would be the implications of changing it to make it work ?

@raf-sh
Copy link

raf-sh commented Nov 14, 2016

Can confirm, have same problem - if there are any tags inside

  • - there is no text in output docx on related lines

    @ZombieBunny
    Copy link

    I seem to have come across the same issue.
    Any tags within a list item tag renders that list item empty when its converted into a word docx file.
    Iv had to remove all other tags between li tags to get the list to display again, this is how i do it:

      `$html = preg_replace_callback('#(<li[^>]*>)(.+?)(</li>)#is', function($m){
            return($m[1].strip_tags($m[2]).$m[3]);
        }, $html);`
    

    I hope this helps as a workaround.

    @troosan
    Copy link
    Contributor

    troosan commented Dec 25, 2017

    this has been partially fixed in milestone v0.14.0, to formatting will be lost but the text will at least be kept.

    @troosan troosan closed this as completed Dec 25, 2017
    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

    5 participants