/ Forums / Advansys Formativ / Creating Solutions with Formativ / Formatting Bodytext in New Mail

  • Creator
    Topic
  • #3903
    rfaude
    Participant

      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

    • Author
      Replies
    • #6569
      Support 1a
      Participant

        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

        #6573
        rfaude
        Participant

          Ok 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 ….

          #6574
          Support 1a
          Participant

            When 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

            #6572
            rfaude
            Participant

              Hey great!!!

              This works very good. Can you give me information where i can find documentation about the format of RTF text?

              Thanks

              Ralf

              #6575
              rfaude
              Participant

                Sorry 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:00

                Beschreibung:

                Great System
                ——————————————

                Any idea.

                Thanks again …

                Ralf

                #6571
                Support 1a
                Participant

                  There 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).

                  RTF Standard

                  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

                  #6570
                  rfaude
                  Participant

                    Yes it works. My first Applet is finished.

                    Thanks.

                    Ralf

                    #6576
                    Support 1a
                    Participant

                      Great news! Let us know if you require any further assistance.

                      Advansys Support

                    Viewing 8 replies - 1 through 8 (of 8 total)
                    • You must be logged in to reply to this topic.