Solved

@NewLine, how to do this using Lotus Notes Script

Posted on 2001-08-29
6
1,722 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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