|
rtHotLink
rtNoteLink
add (rtContainer)
addNewLine (rtContainer)
addNewLine (rTextParagraph)
appendText (rtContainer)
appendText (rTextParagraph)
Add (rtCollection)
Add (rTextParagraph)
Bold
Comment
Current (rTextParagraph)
docLinks
Font
FontAttrib
FontSize
getRichTextItem
hasMoreElements
NextElement
NoteLink
NotesColor
Style
|
Code fragment from sample "Convert DocLinks to Hotspots"; see full running samples in downloadable help.
|
Set ctxDump =New rtContainer
' Set rtp = ctxDump.appendText ("Original stuff:")
Set rtp = new rTextParagraph ("Original stuff:")
ctxDump.add rtp
Set rtp.Current.style = New rtStyle(0)
Set rtp.Current.style.Font = New rtFontStyle(0)
rtp.Current.style.Font.FontSize=18
rtp.Current.style.Font.bold=True
ctxDump.addnewline 1

Call ctxDump.getRichTextItem(doc,"Body")
Set enum = ctxDump.docLinks(false) ' no hotlinks; true - means get also hotlinks (rtHotlink)

Dim o As rtNoteLink ' may be always defined as Variant (we only want Help reference added)
Dim hotlink As rtHotlink ' just some hostpot

Set rtp =New rTextParagraph("Doclinks to hotlinks")
Set rtp.Current.style = New rtStyle(0)
Set rtp.Current.style.Font = New rtFontStyle(0)
rtp.Current.style.Font.FontSize=18
rtp.Current.style.Font.bold=True
ctxDump.addNewLine 1
ctxDump.add rtp
ctxDump.addNewLine 1
' link style
Set font = New rtFontStyle(0)
Font.FontSize=9
Font.NotesColor = NOTES_COLOR_BLUE
Font.FontAttrib = isUnderline

Do While enum.hasMoreElements
 Set o = enum.nextElement
 Set hotlink = New rtHotlink(HOTSPOTREC_RUNFLAG_NOBORDER) ' we do not want the green border, do we?
 Set hotlink.NoteLink = o ' add doclink
 Set rtp = New rTextParagraph (o.Comment) ' use link comment as visible text
 Set rtp.Current.Style.Font = Font
 hotlink.add rtp ' visible link text
 ctxDump.add hotlink
 ctxDump.appendText " "
 ctxDump.addnewline 1
Loop
' and convert one back - just in case
Dim newdocLink as rtNoteLink
set newdocLink = hotlink.NoteLink
newDoclink.Comment = "What'da ya say?"
ctxDump.add newDocLink
|
|