FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.


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% )


FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.