onizet / html2openxml

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
309 stars 106 forks source link

Basic header or footer definition will crash the conversion when image are encountered #159

Closed onizet closed 1 week ago

onizet commented 2 weeks ago

Describe the bug Cross-reference from #CervantesSec/cervantes/issues/51

Repro This line of code is the culprit: mainPart.AddNewPart<HeaderPart>() The definition of the header is incomplete, thus accessing mainParts.HeaderParts.First().Header will throws a null reference exception.

jstangle commented 1 week ago

Hi @onizet, I just tested the latest release. Unfortunately, the images in the header and footer of the HTML are not being displayed in the DOCX report. image

onizet commented 1 week ago

This current issue is fixed. What you are requesting is different, it's the ability to convert html into header and footer. From day 1 I created this library, only the body was officially supported.

I will create a separate work item for that purpose