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
Invalid document when html contains images and existing headers/footers contain images #113
Word reports "unreadable content" when document contains header/footer with images and inserted html contains images.
The problem is in duplicated DocProperties.Id: https://github.com/onizet/html2openxml/blob/09d064c3b8824562f23c54881bdba1b144216de8/src/Html2OpenXml/HtmlConverter.cs#L523
Calculation of drawingObjId in above method considers only elements in document body, not other parts of the document.
My workaround is to renumber generated prop ids (but considering elements in other document parts):