SubInitialize()
Dimsession AsNotesSession
Dimdb AsNotesDatabase
Dimdc AsNotesDocumentCollection
Dimdoc AsNotesDocument
Dimbody AsNotesRichTextItem
Dimrtnav AsNotesRichTextNavigator
Dimrtrange AsNotesRichTextRange
DimsearchString AsString
DimrtnavBody AsNotesRichTextNavigator
DimrtnavPara AsNotesRichTextNavigator
DimrtrangePara AsNotesRichTextRange
DimrtrangeRun AsNotesRichTextRange
DimparaCount AsInteger
DimrunCount AsInteger
Setsession = NewNotesSession
Setdb = session.CurrentDatabase
Setdc = db.UnprocessedDocuments
Ifdc.Count = 0Then
MessageBox"No document selected",, "No doc"
ExitSub
EndIf
Setdoc = dc.GetFirstDocument
Setbody = doc.GetFirstItem("Body")
Setrtnav = body.CreateNavigator
Setrtrange = body.CreateRange
Ifrtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
SetrtrangePara = body.CreateRange
SetrtrangeRun = body.CreateRange
Do
paraCount = paraCount + 1
runCount = 0
CallrtrangePara.SetBegin(rtnav)
CallrtrangePara.SetEnd(rtnav)
SetrtnavPara = rtrangePara.Navigator
REM Get each run in paragraph
REM Display it
CallrtnavPara.FindFirstElement(RTELEM_TYPE_TEXTRUN)
Do
runCount = runCount + 1
CallrtrangeRun.SetBegin(rtnavPara)
'MessageBox rtrangeRun.TextRun,, "Paragraph " & paraCount & ", Run " & runCount
CallrtrangeRun.remove
LoopWhilertnavPara.FindNextElement(RTELEM_TYPE_TEXTRUN)
LoopWhilertnav.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)
Else
MessageBox"No text in Body",, "No paragraph"
EndIf
Calldoc.save(True,True)
EndSub
No comments:
Post a Comment