EvotecIT / OfficeIMO

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
261 stars 47 forks source link

Add AddEmbeddedFragment method #233

Closed PrzemyslawKlys closed 2 weeks ago

PrzemyslawKlys commented 2 weeks ago

This PR resolves:

The following example shows the use case. Remember that opening and closing tags are necessary; otherwise, Microsoft Word won't open the file.

var htmlContent = """
                  <html lang="en">
                  <P>This is a paragraph.</P>
                  <P>This is another paragraph.</P>
                  <P>This is a paragraph with <STRONG>bold</STRONG> text.</P>
                  <P>This is a paragraph with <EM>italic</EM> text.</P>
                  <ul>
                    <li>Item 1</li>
                    <li>Item 2</li>
                    <li>Item 3</li>
                  </ul>
                  <ol>
                    <li>Item 1</li>
                    <li>Item 2</li>
                    <li>Item 3</li>
                  </ol>
                  <P>This is a paragraph with a <A href=""https://www.google.com"">link</A>.</P>
                  </html>
                  """;

document.AddEmbeddedFragment(htmlContent, AlternativeFormatImportPartType.Html);