Message-ID: <897958379.9095.1711675908093.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9094_1830531843.1711675908093" ------=_Part_9094_1830531843.1711675908093 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html HTMLToWord.InsertDelegate

HTMLToWord.InsertDelegate

Description

A user-assigned delegate method that HTMLToWord calls before it proc= esses an XHTML tag. The user may implement code to perform any tasks they d= esire before passing control back to HTMLToWord. The return value from the = delegate method specifies how HTMLToWord should behave. If this property is= not set, HTMLToWord will attempt to insert the contents of the XHTML tag.= =20
C#
=20
public InsertElementDelegate InsertDelegate{ ge=
t; set; }
=20
=20
vb.net
=20
Public Property InsertDelegate() As InsertElemen=
tDelegate
=20
=20

Examples

=20
C#
=20
 //--- We have defined two custom HTML tags for our documents: p=
ara and private.
 //--- If we encounter a &lt;para> tag, we insert a paragraph into t=
he Word document and tell HTMLToWord
 //--- to continue processing.  If we encounter a &lt;private> tag, =
we write a short message into
 //--- the Word document and tell HTMLToWord to skip this tag altogether.
 HTMLToWord.HTMLTagAction MyInserter(Document doc, Element insertAfterEleme=
nt, XmlNode node)
 {
      //--- Get the name of the HTML tag and convert it to lower case.
      string nodeName =3D node.Name.ToLower();
    =20
      if (nodeName.equals("para"))
      {
           //--- There is a special &lt;para> tag in our markup, but=
 we should just treat it
           //--- like a standard HTML &lt;p> tag.  Insert a paragrap=
h into the document and
           //--- let HTML continue processing.
           insertAfterElement.InsertParagraphAfter(null);
      }
      else if (nodeName.equals("private"))
      {
           //--- The "private" tag is used to indicate informatio=
n that should not be sent
           //--- to outside clients; therefore, we tell HTMLToWord to skip =
this tag and its
           //--- contents.
           return HTMLToWord.HTMLTagAction.Skip;
      }
    =20
      //--- We have handled all of the special cases.  Let HTMLToWord know =
that
      //--- it should process this tag.
      return HTMLToWord.HTMLTagAction.Process;
 }


 //--- Create an HTMLToWord instance.
 HTMLToWord h2w =3D new HTMLToWord();
 =20
 //--- Tell HTMLToWord that it should call our "MyInserter" deleg=
ate method=20
 //--- whenever it encounters a tag in the XHTML string.
 h2w.InsertDelegate =3D new HTMLToWord.InsertElementDelegate(MyInserter);
=20
vb.net
=20
 '--- We have defined two custom XHTML tags for our documents: p=
ara and private.
 '--- If we encounter a &lt;para> tag, we insert a paragraph into th=
e Word document and tell HTMLToWord
 '--- to continue processing.  If we encounter a &lt;private> tag, w=
e write a short message into
 '--- the Word document and tell HTMLToWord to skip this tag altogether.
 Function MyInserter(ByVal doc As Document, ByVal insertAfterElement As Ele=
ment, ByVal xmlNode As XmlNode)
   As HTMLToWord.HTMLTagAction
 {
      '--- Get the name of the HTML tag and convert it to lower case.
      Dim nodeName As String =3D node.Name.ToLower()
=20
      If nodeName.Equals("para") Then
           '--- There is a special &lt;para> tag in our markup, but =
we should just treat it
           '--- like a standard HTML &lt;p> tag.  Insert a paragraph=
 into the document and
           '--- let HTML continue processing.
           insertAfterElement.InsertParagraphAfter(Nothing)
      Else If nodeName.Equals("private")
           '--- The "private" tag is used to indicate information=
 that should not be sent
           '--- to outside clients; therefore, we tell HTMLToWord to skip t=
his tag and its
           '--- contents.
           Return HTMLToWord.HTMLTagAction.Skip;
      End If
    =20
      '--- We have handled all of the special cases.  Let HTMLToWord know t=
hat
      '--- it should process this tag.
      Return HTMLToWord.HTMLTagAction.Process
 End Function



 '--- Create an HTMLToWord instance.
 Dim h2w As New HTMLToWord()
 =20
 '--- Tell HTMLToWord that it should call our "MyInserter" delega=
te method=20
 '--- whenever it encounters a tag in the XHTML string.
 h2w.InsertDelegate =3D New HTMLToWord.InsertElementDelegate(AddressOf MyIn=
serter)
 
=20
------=_Part_9094_1830531843.1711675908093--