Solved

@NewLine, how to do this using Lotus Notes Script

Posted on 2001-08-29
6
1,744 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
Independent Software Vendors: 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!

 
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 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