Solved

@NewLine, how to do this using Lotus Notes Script

Posted on 2001-08-29
6
1,713 Views
Last Modified: 2013-12-18
Hello!

I like to add text to body field before the mail is send, i need to add one blank line first and then three lines of text, then "newline" and again three lines of text. How can i do this and on which event?

Thanks, Karen
0
Comment
Question by:karen021897
  • 3
  • 2
6 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6436449
Hi Karen,

There is no such event to control the editing of rich text but you can handle the rich text item by using the backend methods

To add text use....

AppendText method  

Example
Appends text to the end of a rich-text item. The text is rendered with the current style of the item (such as bold or italics).

Defined in
NotesRichTextItem
Syntax
Call notesRichTextItem.AppendText( text$ )
Parameters
text$
String. The text to append.

EXAMPLE:
Dim doc As NotesDocument
Dim rtitem As Variant
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
  Call rtitem.AppendText( "Add text to the rich-text item" )
  Call rtitem.AddNewLine( 1 )
  Call rtitem.AppendText("Add more text to rich-text item")
  Call doc.Save( False, True )
End If

To add blank line use ...

AddNewLine method  

Appends one or more new lines (carriage returns) to the end of a rich-text item.
Defined in
NotesRichTextItem
Syntax
Call notesRichTextItem.AddNewLine( n% [, forceParagraph ])
Parameter
n%
Note  In COM this parameter is optional and defaults to 1.
Integer. The number of new lines to append.
forceParagraph
Boolean. Optional. If True, forces the new line to be a paragraph separator. If False, the new line is added, but does not force a new paragragh. True by default.

EXAMPLE

This script finds the ProjectDescription item in a document. It adds a carriage return and some text to the item.

Dim doc As NotesDocument
Dim rtitem As Variant
'...set value of doc...
Set rtitem = doc.GetFirstItem( "ProjectDescription" )
If rtitem.Type = RICHTEXT Then
  Call rtitem.AddNewLine( 1 )
  Call rtitem.AppendText( "Book is 64 pages, full color." )
End If
Call doc.Save( False, True )
If the ProjectDescription item used to contain the text value "Cartoon book for children ages 9-12," it now contains the following:
Cartoon book for children ages 9-12
Book is 64 pages, full color.

Check help for more information

~Hemanth
0
 
LVL 4

Expert Comment

by:sloeber
ID: 6436521
This is how I did it

FIELD History := History;
date := @Text(@Now);
item := @NewLine + @NewLine + date + " Reminder verstuurd door  " + @Name([CN]; @UserName) + @Newline + @NewLine + "blablablabla";
selection := item:History;
@SetField("History";selection);
@MailSend(Bestemmeling;"";"";"Reminder : Gelieve factuur " + Faktuur + " van vendor " + VendorCode + " na te kijken ";"";"Link naar het document  ";[IncludeDoclink]);
@Prompt([OK];"Reminder";"Er is een mailtje verzonden naar " + Bestemmeling)
0
 

Author Comment

by:karen021897
ID: 6436605
I need to use this code in QuerySave event in memo form

Sub Querysave(Source As Notesuidocument, Continue As Variant)
     Call source.FieldSetText("useApplet", "True")
     Call cMemoObject.QuerySave(Continue)    

Here you may put the code

End Sub
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6439748
Try this in querysave

Sub Querysave(Source As Notesuidocument, Continue As Variant)
    Call source.FieldSetText("useApplet", "True")
    Call cMemoObject.QuerySave(Continue)    

Dim doc as NotesDocument
Dim rtitem As NotesRichTextItem
set doc = Source.Document
Set rtitem = doc.GetFirstItem( "RichText" )
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( "Line #1" )
Call rtitem.AppendText( "Line #2" )
Call rtitem.AppendText( "Line #3" )
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( "Line #1" )
Call rtitem.AppendText( "Line #2" )
Call rtitem.AppendText( "Line #3" )

End Sub

~Hemanth
0
 

Author Comment

by:karen021897
ID: 6439942
Object variable not set
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 100 total points
ID: 6445893
Use this

If Not Source.IsNewDoc Then
Dim doc as NotesDocument
Dim rtitem As NotesRichTextItem
set doc = Source.Document
Set rtitem = doc.GetFirstItem( "RichText" )
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( "Line #1" )
Call rtitem.AppendText( "Line #2" )
Call rtitem.AppendText( "Line #3" )
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText( "Line #1" )
Call rtitem.AppendText( "Line #2" )
Call rtitem.AppendText( "Line #3" )
Else
Call Source.Save
Call QuerySave(Source,True)
End If

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now