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 into templated Word.
there is one minor thing i'd like to suggest an improvement for.
the <img tag converter generates an xml object "wp:docPr" with a field "name" that contains the contents of the variable "imageSource"
in case of http:// or file:// links this is more or less ok (altough still strange), but in case of base64-inline images, this happens:
-> the entire base64-encoded image ends up in the document multiple times in the "name" tags. i'm surprised this even works correctly, for large images the name tag is huge.
wouldn't it make sense to just generate a random name like "imagex" or maybe even better a random GUID? as far as i understand the "name" tag is not relevant, the image itself is a binary file in the subfolder "media" and insertion is done via two things:
a relationship entry in document.xml.rels
<Relationship Id="R924497be79564037" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.jpg"/>
a blip tag in document.xml
<a:blip r:embed="R924497be79564037" />
i may be wrong - this is my first endeavour into this file format.
Hello! Thanks for this nice library.
there is one minor thing i'd like to suggest an improvement for. the <img tag converter generates an xml object "wp:docPr" with a field "name" that contains the contents of the variable "imageSource"
in case of http:// or file:// links this is more or less ok (altough still strange), but in case of base64-inline images, this happens:
-> the entire base64-encoded image ends up in the document multiple times in the "name" tags. i'm surprised this even works correctly, for large images the name tag is huge.
wouldn't it make sense to just generate a random name like "imagex" or maybe even better a random GUID? as far as i understand the "name" tag is not relevant, the image itself is a binary file in the subfolder "media" and insertion is done via two things:
<Relationship Id="R924497be79564037" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.jpg"/>
<a:blip r:embed="R924497be79564037" />
i may be wrong - this is my first endeavour into this file format.