Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Description

Excerpt

Use the HTMLToWord object to insert well-formed HTML (XHTML) text into a WordWriter 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.

Signature
C#C#
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}{signature:vb.net
vb.net
}
Public Class HTMLToWord
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 and IncludeContentsOfUnknownTags properties found in the HTMLInsertProperties property container.

For an overview of how to use the HTMLToWord object, see Using 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)
Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle
Fields

...

Name

...

Description

...

FormatElementDelegate

...

{code}

{example}
{fields}
||Name||Description||
|[FormatElementDelegate|HTMLToWord.FormatElementDelegate]|{excerpt-include:HTMLToWord.FormatElementDelegate

...

GetImageDelegate

|nopanel=true}|
|[GetImageDelegate|HTMLToWord.GetImageDelegate]|{excerpt-include

...

:HTMLToWord.GetImageDelegate

...

InsertElementDelegate

|nopanel=true}|
|[InsertElementDelegate|HTMLToWord.InsertElementDelegate]|{excerpt-include

...

:HTMLToWord.InsertElementDelegate

...

Properties

...

Name

...

Description

...

DebugLogLevel

...

FormatDelegate

...

ImageDelegate

...

InsertDelegate

...

InsertProperties

...

LogFileName

...

Methods

...

Name

...

Description

...

InsertHTML(String, Document, NamedStyle, Element)

...

|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

...

Classes

...

Name

...

Description

...

HTMLInsertProperties

...

=true}|
{classes}
||Name||Description||
|[HTMLInsertProperties|HTMLToWord.HTMLInsertProperties]|{excerpt-include:HTMLToWord.HTMLInsertProperties

...

HTMLTagAction

|nopanel=true}|
|[HTMLTagAction|HTMLToWord.HTMLTagAction]|{excerpt-include

...

:HTMLToWord.HTMLTagAction

...

LoggingLevel

|nopanel=true}|
|[LoggingLevel|HTMLToWord.LoggingLevel]|{excerpt-include

...

:HTMLToWord.LoggingLevel

...

|nopanel=true}|