Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

@NewLine, how to do this using Lotus Notes Script

Posted on 2001-08-29
6
Medium Priority
?
1,761 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 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