Sample script for the Format object

Build 1501 on 14/Nov/2017  This topic last edited on: 30/Jul/2012, at 16:00

This example illustrate the usage of the Format object:

  Dim objFormat As Format = Ted.GetFormat

  Dim objT = Ted.GetActiveTxt

   objFormat.Id = objT.FormatId

  Dim str As String = ""

  Dim i As Integer

   str = str & "Id: " & objFormat.Id & vbCrLf

   str = str & "Name: " & objFormat.Name & vbCrLf

  'str = str & "TitleId: " & objFormat.TitleId & vbCrLf

   str = str & "TypeId: " & objFormat.TypeId & vbCrLf

   str = str & "CategoryId: " & objFormat.CategoryId & vbCrLf

   str = str & "TextCopyFit: " & objFormat.TextCopyFit & vbCrLf

   str = str & "DefaultParaCopyFit: " & objFormat.DefaultParaCopyFit & vbCrLf

   str = str & "MinGeoDepth: " & objFormat.MinGeoDepth & vbCrLf

   str = str & "MaxGeoDepth: " & objFormat.MaxGeoDepth & vbCrLf

  Dim objPS = objFormat.DefaultParaStatus

   str = str & "Default Leading: " & objPS.Leading & vbCrLf

  Dim objTS = objFormat.DefaultTextStatus

   str = str & "Default Text Color: " & objTS.Color & vbCrLf

   str = str & "Breakable: " & objFormat.BreakableChars & vbCrLf

   str = str & "NMinBeforeHyphen: " & objFormat.NMinBeforeHyphen & vbCrLf

   str = str & "NMinAfterHyphen: " & objFormat.NMinAfterHyphen & vbCrLf

   str = str & "MinBreakableLen: " & objFormat.MinBreakableLen & vbCrLf

   str = str & "MaxConsecutiveHyphens: " & objFormat.MaxConsecutiveHyphens & vbCrLf

   str = str & "UseLetterSpacing: " & objFormat.UseLetterSpacing & vbCrLf

   str = str & "LineSpacing: " & objFormat.LineSpacing & vbCrLf

   str = str & "DisableCaps: " & objFormat.DisableCaps & vbCrLf

   str = str & "Style library's id: (" & objFormat.NStyleLibs - 1 & ")"

  For i = 0 To objFormat.NStyleLibs - 1

     str = str & objFormat.StyleLibId(CShort(i)) & " "

  Next

   str = str & vbCrLf

  Dim aParaStyles = objFormat.ParaStyles

   str = str & "Paragraph styles: (" & aParaStyles.Count() - 1 & ")" & vbCrLf

  For i = 0 To aParaStyles.Count() - 1

     str = str & " " & aParaStyles(i) & vbCrLf

  Next

 

  Dim aTextStyles = objFormat.TextStyles

   str = str & "Text styles:" & vbCrLf

  For i = 0 To aTextStyles.Count() - 1

     str = str & "        " & aTextStyles(i) & vbCrLf

  Next

  Dim aMacros = objFormat.Macros

   str = str & "Macros:" & vbCrLf

  For i = 0 To aMacros.Count() - 1

     str = str & "        " & aMacros(i) & vbCrLf

  Next

   MsgBox(str)