AbsolutePositionTab Class
An absolute position tab is a character which is used to advance the position on the current line of text when displaying this WordprocessingML content.
Inheritance Hierarchy

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class AbsolutePositionTab : SpecialChar

The AbsolutePositionTab type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleDocument
Gets the document to which this node belongs.
(Inherited from Node.)
Public propertyCode exampleFont
Provides access to the font formatting of this object.
(Inherited from Inline.)
Public propertyCode exampleIsComposite
Returns true if this node can contain other nodes.
(Inherited from Node.)
Public propertyCode exampleIsDeleteRevision
Returns true if this object was deleted in Microsoft Word while change tracking was enabled.
(Inherited from Inline.)
Public propertyCode exampleIsFormatRevision
Returns true if formatting of the object was changed in Microsoft Word while change tracking was enabled.
(Inherited from Inline.)
Public propertyCode exampleIsInsertRevision
Returns true if this object was inserted in Microsoft Word while change tracking was enabled.
(Inherited from Inline.)
Public propertyCode exampleIsMoveFromRevision
Returns true if this object was moved (deleted) in Microsoft Word while change tracking was enabled.
(Inherited from Inline.)
Public propertyCode exampleIsMoveToRevision
Returns true if this object was moved (inserted) in Microsoft Word while change tracking was enabled.
(Inherited from Inline.)
Public propertyCode exampleNextSibling
Gets the node immediately following this node.
(Inherited from Node.)
Public propertyCode exampleNodeType
Returns NodeType.SpecialChar.
(Inherited from SpecialChar.)
Public propertyCode exampleParentNode
Gets the immediate parent of this node.
(Inherited from Node.)
Public propertyCode exampleParentParagraph
Retrieves the parent Paragraph of this node.
(Inherited from Inline.)
Public propertyCode examplePreviousSibling
Gets the node immediately preceding this node.
(Inherited from Node.)
Public propertyCode exampleRange
Returns a Range object that represents the portion of a document that is contained in this node.
(Inherited from Node.)
Methods
  NameDescription
Public methodCode exampleAccept
Accepts a visitor.
(Overrides SpecialCharAccept(DocumentVisitor).)
Public methodCode exampleClone (Inherited from Node.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodCode exampleGetAncestor(Type)
Gets the first ancestor of the specified object type.
(Inherited from Node.)
Public methodCode exampleGetAncestor(NodeType)
Gets the first ancestor of the specified NodeType.
(Inherited from Node.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetText
Gets the special character that this node represents.
(Inherited from SpecialChar.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodCode exampleNextPreOrder
Gets next node according to the pre-order tree traversal algorithm.
(Inherited from Node.)
Public methodCode examplePreviousPreOrder
Gets the previous node according to the pre-order tree traversal algorithm.
(Inherited from Node.)
Public methodCode exampleRemove
Removes itself from the parent.
(Inherited from Node.)
Public methodToString (Inherited from Object.)
Public methodCode exampleToString(SaveFormat)
Exports the content of the node into a string in the specified format.
(Inherited from Node.)
Public methodCode exampleToString(SaveOptions)
Exports the content of the node into a string using the specified save options.
(Inherited from Node.)
Examples
Shows how to use AbsolutePositionTab.
public void DocumentToTxt()
{
    // This document contains two sentences separated by an absolute position tab.
    Document doc = new Document(MyDir + "AbsolutePositionTab.docx");

    // An AbsolutePositionTab is a child node of a paragraph. 
    // AbsolutePositionTabs get picked up when looking for nodes of the SpecialChar type.
    Paragraph para = doc.FirstSection.Body.FirstParagraph;
    AbsolutePositionTab absPositionTab = (AbsolutePositionTab)para.GetChild(NodeType.SpecialChar, 0, true);

    // This implementation of the DocumentVisitor pattern converts the document to plain text.
    MyDocToTxtWriter myDocToTxtWriter = new MyDocToTxtWriter();

    // We can run the DocumentVisitor over the whole first paragraph.
    para.Accept(myDocToTxtWriter);

    // A tab character is placed where the AbsolutePositionTab was found.
    Assert.AreEqual("Before AbsolutePositionTab\tAfter AbsolutePositionTab", myDocToTxtWriter.GetText());

    // An AbsolutePositionTab can accept a DocumentVisitor by itself too.
    myDocToTxtWriter = new MyDocToTxtWriter();
    absPositionTab.Accept(myDocToTxtWriter);

    Assert.AreEqual("\t", myDocToTxtWriter.GetText());
}

/// <summary>
/// Visitor implementation that simply collects the Runs and AbsolutePositionTabs of a document as plain text. 
/// </summary>
public class MyDocToTxtWriter : DocumentVisitor
{
    public MyDocToTxtWriter()
    {
        mBuilder = new StringBuilder();
    }

    /// <summary>
    /// Called when a Run node is encountered in the document.
    /// </summary>
    public override VisitorAction VisitRun(Run run)
    {
        AppendText(run.Text);

        // Let the visitor continue visiting other nodes.
        return VisitorAction.Continue;
    }

    /// <summary>
    /// Called when an AbsolutePositionTab node is encountered in the document.
    /// </summary>
    public override VisitorAction VisitAbsolutePositionTab(AbsolutePositionTab tab)
    {
        // We'll treat the AbsolutePositionTab as a regular tab in this case.
        mBuilder.Append("\t");

        return VisitorAction.Continue;
    }

    /// <summary>
    /// Adds text to the current output. Honors the enabled/disabled output flag.
    /// </summary>
    private void AppendText(string text)
    {
        mBuilder.Append(text);
    }

    /// <summary>
    /// Gets the plain text of the document that was accumulated by the visitor.
    /// </summary>
    public string GetText()
    {
        return mBuilder.ToString();
    }

    private readonly StringBuilder mBuilder;
}
See Also