Solved

Indent Paragraph Code for LotusScript

Posted on 2009-04-14
9
1,226 Views
Last Modified: 2013-12-18
I have been having trouble locating some code for adding a RichText Field.AppendText for an indented paragraph. In Notes itself it would be using the F8 key.  Is there some way to do that with AppendText or AppendStyle?  Some sample code would be helpful. Thanks.
0
Comment
Question by:donnamlamb
[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
  • 5
  • 4
9 Comments
 
LVL 22

Expert Comment

by:mbonaci
ID: 24145921
Have you tried with right margin property of RTParagraphStyle (example from Designer help):
This example sets the right margin property of a rich text paragraph style object.
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Set db = session.Currentdatabase
    Dim doc As New NotesDocument(db)
 
    Call doc.AppendItemValue("From", session.Username)
    Call doc.AppendItemValue("subject", "Meeting agenda")
 
    Dim rtpStyle As NotesrichTextParagraphStyle
    Set rtpStyle = session.CreateRichTextParagraphStyle
 
    Dim richText As New NotesRichTextItem(doc, "Body")
    rtpStyle.RightMargin = RULER_ONE_INCH
 
    Call richText.AppendParagraphStyle(rtpStyle)
    Call richText.AppendText("Where are we now?")
    Call richText.AddNewLine(1)
    Call richText.AppendText (" Where do we go from here?")
 
    Call doc.Save(True, False)

Open in new window

0
 

Author Comment

by:donnamlamb
ID: 24146930
I guess I don't understand how the RightMargin method would produce a paragraph indented from the original margins of an email.  I'm trying to start with the original margin, then indent a whole paragraph to highlight it, and then return the rest of the email to its original margins.  Will the code snippiet you provided do that for me? The RightMargin method would seem to move the right margin in (or to the left) one inch as per your code snippet.  What would that do to the left margin?  And, then, how would I return later to the email's original margins?

Sorry to be "thick" on this, but I'm new to programming for Lotus Notes, even though I've been a programmer in other languages for several years.

Thanks.

Donna
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24147898
This is NotesRichTextParagraphStyle, not NotesEMailMessageTemplateStyle :)

Indentation you want is exactly what I suggested.
It only affects current paragraph (see NotesRichTextNavigator in Designer help to navigate to exact paragraph you want changed).

And it wont do anything to the left margin.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 22

Accepted Solution

by:
mbonaci earned 125 total points
ID: 24147931
It's not margin like in Word, in Notes, every paragraph has its margin.
To test this manually, while in a mail body, right click on text and select "Text properties". Then go to third (paragraph margins) tab.
0
 

Author Comment

by:donnamlamb
ID: 24149560
I tried the code you sent. First of all, since I'm writing this code inside of Microsoft Access, it doesn't know what "RULER_ONE_INCH" means. It thinks it's an undefined variable.  I went to the IBM site and looked it up, and it mentioned a number 1440 (for the number of twips in one inch), however it doesn't give me an equivalent code that VBA would understand.  For instance, a color of Blue is 4. Is there an equivalent for that similar to color numbers?

I tried experimenting with various numbers that I could substitute for the RULER_ONE_INCH constant, and the emails I was producing put all of the characters in each AppendText line all against the left margin in a vertical  position like:

W
h
e
r
e
a
r
e
w
e
n
o
w
?

Any other suggestions?  I really appreciate your trying to help me.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 24156980
To set: notesRichTextParagraphStyle.RightMargin = margin

The following constants are available:
     RULER_ONE_INCH (1440)
     RULER_ONE_CENTIMETER (567)

The unit of measure used by the above constants is a "twip," where one centimeter is 567 twips and one inch is 1440 twips. You can apply arithmetic to the constants to obtain other measurements. For example, RULER_ONE_CENTIMETER * 2 for two centimeters or RULER_ONE_INCH * 0.75 for three-quarters of an inch.


Post the code (you should've said it for OLE)...
0
 

Author Comment

by:donnamlamb
ID: 24198708
Sorry I didn't reply to your last post, mbonaci, I was away from the office for a few days.  I'm back now, but won't get back to this until tomorrow (Wednesday).  Thanks for your patience.

Donna
0
 

Author Comment

by:donnamlamb
ID: 24209024
mbonaci, sorry for the delay in getting back to you.  I have attached a sample of the code I'm trying to use. As stated before, I'm trying to format an indented paragraph from the original margins.  However, the attached code snippet doesn't appear to do anything.  I lost the code that was putting everything in a vertical line like I sent earlier.  This code produces the following:

Beginning paragraph at regular margin.

Indented Paragraph by 1/2 inch.

Ending paragraph back at original margin.

All paragraphs starting at the same spot.  Can you point me in the right direction?  Again, I'm using Microsoft Access to send draft emails via Lotus Notes.

Thanks.

Donna
Sub CreateMail()
Const EMBED_ATTACHMENT As Integer = 1454
    Const EMBED_OBJECT As Integer = 1453
    Const EMBED_OBJECTLINK As Integer = 1452
    Const RULER_ONE_INCH As Integer = 1440
    
   
    Dim S As Object ' use back end classes to obtain mail database name
    Dim db As Object '
    Dim memo As Object 'new document
    Dim RTField As Object
    Dim rtpStyle As Object
    Dim networkid, directory As String
    
    Call CreateNotesSession&
    
    networkid = fOSUserName()
    directory = "mail1\" + networkid
    
    
    Set S = CreateObject("Notes.Notessession") 'create notes session
    Set db = S.GETDATABASE("", directory)
   
    Set memo = db.CreateDocument
    
 
    memo.SendTo = "donna@yahoo.com"
    memo.Subject = "YOUR IMMEDIATE ACTION REQUIRED"
    
    Set RTField = memo.CREATERICHTEXTITEM("Body")
    
    Set rtpStyle = S.CreateRichTextParagraphStyle
 
    Call RTField.AppendText("" & "Beginning paragraph at regular margin.")
    Call RTField.AppendText("" & vbCrLf & vbCrLf)
    rtpStyle.RightMargin = RULER_ONE_INCH * 0.75
    Call RTField.AppendText("" & "Indented Paragraph by 1/2 inch.")
    Call RTField.AppendText("" & vbCrLf & vbCrLf)
    Call RTField.AppendText("" & "Ending paragraph back at original margin.")
 
    'Place in Draft
    '#################
    Call memo.Save(True, True)
    Set S = Nothing
    Set db = Nothing
 
 
End Sub

Open in new window

0
 

Author Closing Comment

by:donnamlamb
ID: 31570122
Thanks for your help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 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