I have some code (posted below) which we use to make sure all our documents are in the correct font etc.
However I have just found out that the code doesn’t work if the RTF is over 64K (in which case Notes splits the information and creates a second field of the same name). In this instance only the text in the first instance is changed.
Can anyone help me amend my code, please …
Thanks
Paul
Dim session As New notessession
Dim doc As NotesDocument
Set doc = Source.Document
Dim item As NotesItem
Dim itemType As Integer
Dim body As NotesRichTextItem
Dim nav As NotesRichTextNavigator
Dim range As NotesRichTextRange
Dim mmfontsize As NotesRichTextStyle
Set mmfontsize = session.CreateRichTextStyle
Dim mmfontface As NotesRichTextStyle
Set mmfontface = session.CreateRichTextStyle
Dim mmfontul As NotesRichTextStyle
Set mmfontul = session.CreateRichTextStyle
Dim rts As NotesRichTextSection
Forall items In doc.Items
If items.Type = 1 Then
Set body = doc.GetFirstItem(items.Name)
Set nav = body.CreateNavigator
Set range = body.CreateRange
mmfontsize.FontSize = 9
mmfontface.NotesFont = body.GetNotesFont("Arial",True)
mmfontul.Underline = False
’ go through section headings
If nav.FindFirstElement(RTELEM_TYPE_SECTION) Then
Set range = body.CreateRange
Do
Set rts = nav.GetElement
If rts.TitleStyle.Underline = True Then
Call rts.SetTitleStyle(mmfontul)
Call rts.SetTitleStyle(mmfontsize)
Call rts.SetTitleStyle(mmfontface)
End If
If rts.TitleStyle.FontSize > 9 Then
Call rts.SetTitleStyle(mmfontsize)
Call rts.SetTitleStyle(mmfontface)
End If
If rts.TitleStyle.NotesFont <> body.GetNotesFont("Arial",True) Then
Call rts.SetTitleStyle(mmfontsize)
Call rts.SetTitleStyle(mmfontface)
End If
Loop While nav.FindNextElement(RTELEM_TYPE_SECTION)
End If
’ go through text runs
If nav.FindFirstElement(RTELEM_TYPE_TEXTRUN) Then
Set range = body.CreateRange
Do
range.SetBegin nav
range.SetEnd nav
If range.Style.FontSize > 9 Then
Call range.SetStyle(mmfontsize)
End If
If range.Style.NotesFont <> body.GetNotesFont("Arial",True) Then
Call range.SetStyle(mmfontface)
End If
If range.Style.Underline = True Then
Call range.SetStyle(mmfontul)
End If
Loop While nav.FindNextElement(RTELEM_TYPE_TEXTRUN)
End If
End If
End Forall
Call doc.Save(True,True)