Solved

@NewLine, how to do this using Lotus Notes Script

Posted on 2001-08-29
6
1,718 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

28 Experts available now in Live!

Get 1:1 Help Now