2 Replies Latest reply: Jan 21, 2014 11:38 AM by Clever Anjos RSS

    format text by code

    Andrea Masciulli

      Hello to all

      I need to change the formatting of text in a text field (font, size, and bold) when a button is clicked.

      as you format text by code?



        • Re: format text by code
          Michael Solomovich

          Here is a macro example from APIGiude, it applies font to the active sheet:


          sub Font

          rem set active sheet to Arial 14 bold

          set sp = ActiveDocument.ActiveSheet.GetProperties

          set sfont = sp.SheetFont

          sfont.FontName = "Arial"

          sfont.Bold = true

          sfont.Italic = false

          sfont.Underline = false

          sfont.PointSize1000 = 14000

          ActiveDocument.ActiveSheet.SetFont sfont

          end sub

          • Re: format text by code
            Clever Anjos

            You can do it using macros.



            sub IncreaseFont
              set obj = ActiveDocument.GetSheetObject("CH01")
              set fnt = obj.GetFrameDef.Font
              fnt.PointSize1000 = fnt.PointSize1000 + 1000
              fnt.Bold = true
              fnt.Italic = true
              fnt.Underline = true
              obj.SetFont fnt
            end sub