Converttohtml (NotesRichTextItem - LotusScript®)
Call this method to convert a RichTextItem to an HTML string. The form of the HTML created is similar to what is produced by the Domino® web server and sent to the client. Parameters that guide how the conversion is done can be supplied by a Vector of Strings (Java™) or an array of strings (LS). After this method is called, the getHTMLReferences (RichTextItem class) method can be called. This call returns a Vector (Java™) or array (LS) of HTMLReference objects. Each reference object has a Type property, which may be queried to determine how to interpret the data contained within the reference. The HTMLReference class was created to represent the data contained within an HTML reference.
Defined in
Syntax
HTMLStrings$ = NotesRichTextItem .Converttohtml([options] ) As String
Parameters
Parameter | Description |
---|---|
Options |
Variant. Option. A string array which includes the parameters list for converting. |
Return Values
Return value | Description |
---|---|
Strings |
The strings of HTML converted from the RTF field content. |
Language cross-reference
converttohtml in Java™ RichTextItem class
converttohtml in JavaScript™ NotesRichTextItem class
Examples
This example demonstrates one way to use this method to convert a RichTextItem to an HTML string:Sub Initialize
Dim s As New NotesSession
Dim doc As NotesDocument
Dim col As NotesDocumentCollection
Dim db As NotesDatabase
Dim rt As NotesRichTextItem
Dim ref As NotesHTMLReference
dim refs As Variant
dim ret As String
Dim htmlstr As String
Set db = s.Currentdatabase
Set col = db.Unprocesseddocuments
Set doc = col.Getfirstdocument()
Set rt = doc.Getfirstitem("RTF")
Dim options(9) As String
options(0)="AutoClass=2"
options(1)="RowAtATimeTableAlt=2"
options(2)="SectionAlt=1"
options(3)="XMLCompatibleHTML=1"
options(4)="AttachmentLink=0"
options(5)="TableStyle=1"
options(6)="FontConversion=1"
options(7)="LinkHandling=1"
options(8)="ListFidelity=1"
options(9)="ParagraphIndent=2"
htmlstr=rt.Converttohtml(options)
ret="HTML Converted On "+CStr(Now())+Chr(13)+Chr(10)
ret=ret+htmlstr
refs = rt.GetHTMLreferences()
If( Not IsEmpty(refs)) then
Dim i As Integer
i=0
ForAll obj in refs
Set ref = obj
ret=ret+Chr(13)+chr(10)
ret=ret+"Refrence Number:"+CStr(i)+Chr(13)+chr(10)
ret=ret+"Command ID:"+CStr(ref.Commandid)+Chr(13)+chr(10)
ret=ret+"Type ID:"+CStr(ref.Type)+Chr(13)+chr(10)
ret=ret+"URL:"+CStr(ref.Url)+Chr(13)+chr(10)
ret=ret+"FileName:" + CStr(ref.Filename)+Chr(13)+chr(10)
i=i+1
Call ref.Extractfile("eee"+CStr(i)+".gif")
End ForAll
End if
MsgBox ret
End Sub