Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Excerpt Include
WW8:HTMLToWord ObjectWW8:HTMLToWord Object
nopaneltrue
HTMLToWord Object

Table of Contents

Table of Contents

...

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

Examples:

Code Block
c#c#
titleC#
c#
//--- Well-formed HTML fragment to be inserted into the document.
string htmlFragment = @"<p><b>Hello,</b><i> World</i>!</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 Block
vb.netvb.net
titleVB.NET
vb.net
'--- Well-formed HTML fragment to be inserted into the document.
Dim htmlFragment As String = "<p><b>Hello,</b><i> World</i>!</p>"

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

'--- Create the HTMLToWord object.
Dim h2w As HTMLToWord = new HTMLToWord

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

...

Name

Description

HTMLToWord.Delegates.InsertElementDelegate

Type for user-defined delegate method called by HTMLToWord before inserting an element.\
HTMLTagAction InsertElementDelegate(Document doc, Element insertAfterElement, XmlNode node)

HTMLToWord.Delegates.FormatElementDelegate

Type for user-defined delegate method called by HTMLToWord after inserting an element.\
void FormatElementDelegate(Element insertedElement, XmlNode node)

HTMLToWord.Delegates.GetImageDelegate

Type for user-defined delegate method called by HTMLToWord when an HTML img tag is encountered.\
System.IO.Stream GetImageDelegate(string URI)

...

Property

Type

Access

Description

DebugLogLevel

HTMLToWord.LoggingLevel

read \
write

Sets the amount of information written to the debug log file

FormatDelegate

FormatElementDelegate

read \
write

User-assigned delegate method that is called after HTMLToWord inserts an Element into the Word document

ImageDelegate

GetImageDelegate

read \
write

User-assigned delegate method that allows users to provide an implementation for retrieving the contents of an image and passing it back to HTMLToWord for insertion into a document

InsertDelegate

InsertElementDelegate

read \
write

A user-assigned delegate method that HTMLToWord calls before it processes an XHTML tag

InsertProperties

HTMLInsertProperties

read \
write

Contains settings that control how unsupported HTML tags are treated and provides an override to the default font used when inserting text into the document.

LogFileName

String

read \
write

The full path to the HTMLToWord debug log file

...

Returns

Signature and Description

Element

HTMLToWord.InsertHTML(String, Document)\
Processes the XHTML string and inserts it at the end of the specified Word document as formatted text using the document's Normal style as the default font. Returns the last Element inserted into the document

Element

HTMLToWord.InsertHTML(String, Document, Element)\
Processes the XHTML string and inserts it into the specified Word document as formatted text after the given WordWriter Element using the document's Normal style as the default font. Returns the last Element inserted into the document

Element

HTMLToWord.InsertHTML(String, Document, NamedStyle, Element)\
Processes the XHTML string and inserts it into the specified Word document as formatted text after the given WordWriter Element using the given NamedStyle. Returns the last Element inserted into the document