Html2OpenXml is a small .Net library that convert simple or advanced HTML to plain OpenXml components. This program has started in 2009, initially to convert user's comments from SharePoint to Word.
MIT License
297
stars
106
forks
source link
Sequence contains no elements on an empty header tag #141
Describe the bug
When HTML has an empty h3 tag, the following line in processHeading function, that gets the first item in the element throws an exception
Expected behavior
would it be possible to create a heading line with no text in it instead? or a space? or skip it entirely?
I was just hoping it wouldn't fail the entire export when it's just that one heading tag that's has a problem?
Repro
I can patch it now by running a regex query to remove all empty HTML tags although it would be better if the empty headings can still be there so different sections of the output word document can still be collapsed even without a text as section titles
Repro.docx
BTW, Thank you so much for continuously supporting this library, it has made exporting web content to word so much easier
Hello,
I'm sorry about this bug but the good news is that I have also discovered and fixed it in the v3 of this library.
I'm actively working on it.
Stay tuned and thank you for your kind words!
Describe the bug When HTML has an empty h3 tag, the following line in processHeading function, that gets the first item in the element throws an exception![image](https://github.com/onizet/html2openxml/assets/48846832/38d3b722-d945-4f55-9e57-3d59c8f25d9c)
Expected behavior would it be possible to create a heading line with no text in it instead? or a space? or skip it entirely? I was just hoping it wouldn't fail the entire export when it's just that one heading tag that's has a problem?
Repro![image](https://github.com/onizet/html2openxml/assets/48846832/326329b9-574b-400d-ba72-0128bafe9ede)
I can patch it now by running a regex query to remove all empty HTML tags although it would be better if the empty headings can still be there so different sections of the output word document can still be collapsed even without a text as section titles Repro.docx
BTW, Thank you so much for continuously supporting this library, it has made exporting web content to word so much easier