Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{description}
{excerpt}Use the [HTMLToWord|HTMLToWord] object to insert well\-formed HTML \(XHTML\) text into a WordWriter [Document|Document] object. You can specify a style to use when inserting text or use the document's default style. You can also specify whether to insert text after a specific element or at the end of a document.{excerpt}
{signature:C#}
 public class HTMLToWord
{signature}{signature:vb.net}
Public Class HTMLToWord
{signature}
{remarks}The contents of HTML tags not listed on the [HTMLToWord Supported Tags] may be inserted into the document as plain text.  The behavior is dependent on the settings of the [AcceptUnknownTags|HTMLToWord.HTMLInsertProperties.AcceptUnknownTags] and [IncludeContentsOfUnknownTags|HTMLToWord.HTMLInsertProperties.IncludeContentsOfUnknownTags] properties found in the [HTMLInsertProperties|HTMLToWord.HTMLInsertProperties] property container.

For an overview of how to use the HTMLToWord object, see [Using HTMLToWord].

{remarks}
{example}{code:csharp|title=C#}

//--- Well-formed HTML fragment to be inserted into the document.
string htmlFragment = @"<{span}{/span}p><{span}{/span}b>Hello,<{span}{/span}/b><{span}{/span}i> World<{span}{/span}/i>!<{span}{/span}/p>";


//--- Open an existing Word document with the SoftArtisans WordApplication object.
WordApplication wApp = new WordApplication();
Document doc = wApp.Open("myDoument.doc");

//--- Create the HTMLToWord object.
HTMLToWord h2w = new HTMLToWord();

//--- Insert the HTML fragment at the end of the document.
//--- Use the default style.
h2w.InsertHTML(htmlFragment, doc, null, doc);
{code}
{code:vb.net|title=vb.net}

'--- Well-formed HTML fragment to be inserted into the document.
Dim htmlFragment As String = "<{span}{/span}p><{span}{/span}b>Hello,<{span}{/span}/b><{span}{/span}i> World<{span}{/span}/i>!<{span}{/span}/p>"

'--- Open an existing Word document with the SoftArtisans WordApplication object.
Dim wApp As New WordApplication()
Dim doc As Document = wApp.Open("myDoument.doc")

'--- Create the HTMLToWord object.
Dim h2w As New HTMLToWord()

'--- Insert the HTML fragment at the end of the document.
'--- Use the default style.
h2w.InsertHTML(htmlFragment, doc, Nothing, doc)
{code}

{example}
{fields}
||Name||Description||
|[FormatElementDelegate|HTMLToWord.FormatElementDelegate]|{excerpt-include:HTMLToWord.FormatElementDelegate|nopanel=true}|
|[GetImageDelegate|HTMLToWord.GetImageDelegate]|{excerpt-include:HTMLToWord.GetImageDelegate|nopanel=true}|
|[InsertElementDelegate|HTMLToWord.InsertElementDelegate]|{excerpt-include:HTMLToWord.InsertElementDelegate|nopanel=true}|
{properties}
||Name||Description||
|[DebugLogLevel|HTMLToWord.DebugLogLevel]|{excerpt-include:HTMLToWord.DebugLogLevel|nopanel=true}|
|[FormatDelegate|HTMLToWord.FormatDelegate]|{excerpt-include:HTMLToWord.FormatDelegate|nopanel=true}|
|[ImageDelegate|HTMLToWord.ImageDelegate]|{excerpt-include:HTMLToWord.ImageDelegate|nopanel=true}|
|[InsertDelegate|HTMLToWord.InsertDelegate]|{excerpt-include:HTMLToWord.InsertDelegate|nopanel=true}|
|[InsertProperties|HTMLToWord.InsertProperties]|{excerpt-include:HTMLToWord.InsertProperties|nopanel=true}|
|[LogFileName|HTMLToWord.LogFileName]|{excerpt-include:HTMLToWord.LogFileName|nopanel=true}|
{methods}
||Name||Description||
|[InsertHTML(String, Document, NamedStyle, Element)|HTMLToWord.InsertHTML(String, Document, NamedStyle, Element)]|{excerpt-include:HTMLToWord.InsertHTML(String, Document, NamedStyle, Element)|nopanel=true}|
|[InsertHTML(String, Document, Element)|HTMLToWord.InsertHTML(String, Document, Element)]|{excerpt-include:HTMLToWord.InsertHTML(String, Document, Element)|nopanel=true}|
|[InsertHTML(String, Document)|HTMLToWord.InsertHTML(String, Document)]|{excerpt-include:HTMLToWord.InsertHTML(String, Document)|nopanel=true}|
{classes}
||Name||Description||
|[HTMLInsertProperties|HTMLToWord.HTMLInsertProperties]|{excerpt-include:HTMLToWord.HTMLInsertProperties|nopanel=true}|
|[HTMLTagAction|HTMLToWord.HTMLTagAction]|{excerpt-include:HTMLToWord.HTMLTagAction|nopanel=true}|
|[LoggingLevel|HTMLToWord.LoggingLevel]|{excerpt-include:HTMLToWord.LoggingLevel|nopanel=true}|