TxtFormat Method

Build 1501 on 14/Nov/2017  This topic last edited on: 10/Oct/2016, at 13:06

Description

Opens a dialog to set the format for the selected text. If no frame is selected, sets the format for the current story.

Syntax

Page.TxtFormat

Example

This script sets the same format to all elements of an article:

Public Overridable Sub SetFormatOnAllElements()

    ' sets the format on all elements of the current article

    ' v1 on 18/Mar/13 (BS)

    If Page.TxtFormat = GLOB.EOK Then

      Dim strname As String = ""

      Dim objid = Page.GetSelectedId

      If Ted.HasActiveTxt Then strname = Ted.GetActiveTxt.FormatName

      If Ted.HasActiveArticle And strname <> "" Then

        Dim objArt = Ted.GetActiveArticle

        Dim nIdx = objArt.GetCurTxtIdx

        For i = 0 To objArt.NTxts - 1

          Dim objNode = objArt.GetTxtNode(i)

          If objNode.IsLinked Then

            objArt.GotoTxtEx(i, FalseTrue, 2)

            If objArt.GetTxtNode(i).TypeName <> "mobile" Then Page.TxtFormatName(strname)

            objArt.CloseTxt(i, False)

          End If

        Next

        If nIdx >= 0 Then

          Dim objNode = objArt.GetTxtNode(nIdx)

          If objNode.IsLinked Then

            objArt.GotoTxtEx(nIdx, FalseTrue, 2)

            If objArt.GetTxtNode(nIdx).TypeName <> "mobile" Then Page.TxtFormatName(strname)

            objArt.CloseTxt(nIdx, False)

          End If

        Else

          If objArt.NTxts > 0 Then

            Dim objNode = objArt.GetTxtNode(0)

            If objNode.IsLinked Then

              objArt.GotoTxtEx(0, FalseTrue, 2)

              If objArt.GetTxtNode(0).TypeName <> "mobile" Then Page.TxtFormatName(strname)

              objArt.CloseTxt(0, False)

            End If

          End If

        End If

      End If

    End If

  End Sub

 

Context

Page designer

See also

TxtAssignFormat, TxtFormatList, TxtFormatName