Jan 30, 2018, 1:08 PM
24 Posts
topic has been resolvedResolved

equivalent in ls for [TextsetFontcolor]

  • Category: Other
  • Platform: Windows
  • Release: 9.0.1
  • Role: Administrator
  • Tags:
  • Replies: 1

Hi !

I want to change the Size, Color and Font of a selected text in a document via "button click".

Working is this formula:

@Command([TextSetFontSize]; "10") ;
@Command([TextSetFontColor]; [blue]) ;
@Command( [TextSetFontFace] ; "Trebuchet MS" )

 

But I need a special RGB color for the FontColor, So I think it´s just possible in lotus script.

I´m searching for examples , because my ls knowledge is not sufficient .

Thanks in advance.

 

Steffi

 

 

Jan 30, 2018, 1:39 PM
21 Posts
This is how I do it

Assuming the rich text field is named Body;

 

Set style = Session.CreateRichTextStyle
style.FontSize = 14
style.NotesColor = Color_Gray
Set item = doc.GetFirstItem(fnBody)
    If item.Type = RICHTEXT Then
        Set Body = doc.GetFirstItem(fnBody)
        
        Set range = Body.CreateRange()
        Call range.SetStyle(style)
        Body.Compact
        Body.Update

.
.
.

doc.Save

 

I use this code in the backend. Almost certainly it won't work in the UI without closing and reopening the doc.

To get any RBG color, use the NotesColorObject:

notesColor% = notesColorObject.SetRGB( red% , green% , blue% )