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
289 stars 50 forks source link

Add AddEmbeddedFragment method #233

Closed PrzemyslawKlys closed 5 months ago

PrzemyslawKlys commented 5 months 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);