Nov 18, 2017, 5:29 PM
21 Posts

Mistakes retrieving / setting font style in richtext paragraph

  • Category: Domino Designer
  • Platform: All Platforms
  • Release: 9.0.1
  • Role:
  • Tags:
  • Replies: 0


in Version 9.0.1 FP 9 I have found some new mistakes retrieving / setting font size and style in a richtext item.

In a given document containing a richtextitem (named "Body") with some text paragraphs if you copy it to another database with the following code:

dim dbDest as NotzesDatabase

Dim rtBody As NotesRichTextItem

Set docTemp = docCurrent.Copytodatabase(dbDest)

set rtBody = docTemp.GetFirstItem("Body")

Call docTemp.Save(True, False)

the style for all paragraphs is completly changed to 'Roman' size 12, although the original style is 'Helv' size 10.

A workarround is:

Set docTemp = docCurrent.Copytodatabase(dbDest)

        Call docTemp.Save(true, false)
        sNoteID = docTemp.Noteid

        Set docTemp = Nothing
        Set docTemp = dbDest.Getdocumentbyid(sNoteid)

set rtBody = docTemp.GetFirstItem("Body")

Call docTemp.Save(True, False)

I don't know why this is necessary.

If you want to identify the font style for all paragraphs in the document with the following code:

        Set rtnav = body.CreateNavigator

        If rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH) Then
                Dim rtRange As NotesRichTextRange
                Dim style As NotesRichTextStyle
                Set rtrange = Body.CreateRange
                Call rtrange.Setbegin(rtnav)
                Set style = rtrange.Style
                Print "OStyle=" & CStr(style.Notesfont) & ", OGröße=" & CStr(style.Fontsize) & " (" & CStr(iCount) & ")"
                iCount= iCount + 1
            Loop While rtnav.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)

you will see that the font style you will get for all paragraphs is  '0' (='Roman') and size 12 although the actual style for the paragraphs are different an nowhere 'Roman' size 12! So the functionality seems to be unable to retrieve the actual font style.

If you try to change text in the richtext item with:

        Set rtnav = rtBody.CreateNavigator
        Call rtnav.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH)

        Set rtrange = rtBody.CreateRange
        Call rtrange.Setbegin(rtnav)
        Call rtnav.Setpositionatend(rtnav)
        Call rtrange.Setend(rtnav)

iCount = rtrange.FindAndReplace (sPlaceholderName, vPlaceValue, 24)  

                If (iCount > 0) then
                    Call rtBody.Update()
                End If

the style is changed for all paragraphs to 'Roman' size 12.

These are new mistakes in FP9. I have tested it. With FP6 it worked fine. I hope these mistakes will be eliminated in FP10.