/ Forums / Advansys Formativ / Creating Solutions with Formativ / Formatting Bodytext in New Mail
-
CreatorTopic
-
February 5, 2003 at 1:17 am #3903
Hi,
we want formatting the bodytext when composing new mail.
For example:
Hello <Italic>Mr. Support<Italic>
Is it possible to write Mr. Support in Itallic or Bold?
Thanks.
Ralf
-
CreatorTopic
-
AuthorReplies
-
February 5, 2003 at 5:40 pm #6569
Here’s some code that creates a composing item, then types in some formatted text:
Sub Main(Client, GWEvent) Call GroupWise.NewMail Call GroupWise.FocusSet(10, "") Call GroupWise.TypeText("Hello ") Call GroupWise.FontBold(True) Call GroupWise.TypeText("Mr Support") Call GroupWise.FontBold(False) End Sub
If you already had a composing item open, use the same code without the .NewMail() line.
I hope this helps.
Advansys Support
February 6, 2003 at 12:23 pm #6573Ok this works fine, but how can i use it in the following code?
——————–%——————–
‘ Create a email message
Set NewMsg = GroupWise.Account.MailBox.Messages.Add(“GW.MESSAGE.MAIL”, 4)‘ Add a recipient
MsgRecipient = NewMsg.Recipients.Add(GroupWise.Account.Owner.EmailAddress,,0)‘ Subject and body text of the mail
NewMsg.FromText = GroupWise.Account.Owner.DisplayName
NewMsg.Subject = “System Störung”
NewMsg.BodyText.PlainText = “System: ” & ComboBoxKategorie.Text & NL _
& “Datum: ” & DateTime1.Date & NL _
& “Dauer: ” & DateTime2.Time & NL & NL _
& “Beschreibung: ” & NL _
& “—————-” & NL & MemoControl1.Text‘ Send the email by calling the send method
Set objEmail = NewMsg.Send
——————-%——————————–Here i want to format SYSTEM, DATUM, DAUER, BESCHREIBUNG in Bold Letters?
Thanks.
Ralf
PS: Cool new Webdesign, wau ….
February 6, 2003 at 3:31 pm #6574When you mentioned a composing message, I thought you meant a message that was being composed and was not in the message store. In that situation you can use tokens as suggested.
When you are creating a message programmatically and with no user interface, you really need to use the RTF (Rich Text Format) property of the message body text to get the desired results. It’s a little more difficult to do, but here’s a simple example. Note I have greatly simplified the RTF code in this example:
Sub Main(Client, GWEvent) dim iBody iBody = "{rtf1ansiansicpg1252uc1 {This is plain" &_ "par" &_ "par This is }{b bold}{" &_ "par This is }{i italics}{" &_ "par }}" ' Create a email message Set NewMsg = GroupWise.Account.MailBox.Messages.Add("GW.MESSAGE.MAIL", 4) ' Add a recipient MsgRecipient = NewMsg.Recipients.Add(GroupWise.Account.Owner.EmailAddress,,0) ' Subject and body text of the mail NewMsg.FromText = GroupWise.Account.Owner.DisplayName NewMsg.Subject = "System Störung" NewMsg.BodyText.RTF = iBody NewMsg.Send End Sub
I hope this helps.
Advansys Support
February 12, 2003 at 3:14 am #6572Hey great!!!
This works very good. Can you give me information where i can find documentation about the format of RTF text?
Thanks
Ralf
February 12, 2003 at 3:54 am #6575Sorry i forgot to ask.
i used this code to insert plain text
———————-%————————
NewMsg.BodyText.PlainText = “System: ” & InsTab & ComboBoxKategorie.Text & NL _
& “Datum: ” & InsTab & DateTime1.Date & NL _
& “Uhrzeit: ” & InsTab & DateTime3.Time & NL _
& “Dauer: ” & InsTab & DateTime2.Time & NL & NL _
& “Beschreibung: ” & NL _
& “—————-” & NL & MemoControl1.Text
———————-%————————you know i want to change this in RTF to do some formats. I tried the code
———————-%————————
iBody = “{rtf1ansiansicpg1252uc1 {This is plain” &_
“par” &_
“par b System:}ComboBoxKategorie.Text{” &_
“par This is }{i italics}{” &_
“par }}”
———————-%————————but the access to the variable ComboBoxKategorie.Text does not work.
The Result should look like:
——————————————
System: Formativ
Datum: 12.02.2003
Uhrzeit: 12:00:00
Dauer: 00:10:00Beschreibung:
Great System
——————————————Any idea.
Thanks again …
Ralf
February 12, 2003 at 3:08 pm #6571There are many references on the web regarding the RTF standard. Here’s a link to the first hit I recieved after searching for “Rich Text Format”. Please note I can’t vouch for the accuracy for the information on this site (I haven’t read it any detail).
An easy way to see the RTF codes you need to use would be to manually create a message in GroupWise, save the message to Work in Progress, then use the Object API to access the message you created and access the Message.BodyText.RTF property, which will return the RTF representation of the message.
Regarding your second question, it appears you have not properly delimetered your variable. I.e, you need something like (from the top of head – untested code):
iBody = “{rtf1ansiansicpg1252uc1 {This is plain” &_
“par” &_
“par b System:}” & ComboBoxKategorie.Text & “{” &_
“par This is }{i italics}{” &_
“par }}”Note the ComboBoxKategorie.Text variable is now delimitered from the rest of the literal string.
I hope this helps.
Advansys Support
February 17, 2003 at 4:03 am #6570Yes it works. My first Applet is finished.
Thanks.
Ralf
February 17, 2003 at 2:52 pm #6576Great news! Let us know if you require any further assistance.
Advansys Support
-
AuthorReplies
- You must be logged in to reply to this topic.