AbsolutePositionTab Class |
Namespace: Aspose.Words
The AbsolutePositionTab type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | Document |
Gets the document to which this node belongs.
(Inherited from Node.) |
![]() ![]() | Font |
Provides access to the font formatting of this object.
(Inherited from Inline.) |
![]() ![]() | IsComposite |
Returns true if this node can contain other nodes.
(Inherited from Node.) |
![]() ![]() | IsDeleteRevision |
Returns true if this object was deleted in Microsoft Word while change tracking was enabled.
(Inherited from Inline.) |
![]() ![]() | IsFormatRevision |
Returns true if formatting of the object was changed in Microsoft Word while change tracking was enabled.
(Inherited from Inline.) |
![]() ![]() | IsInsertRevision |
Returns true if this object was inserted in Microsoft Word while change tracking was enabled.
(Inherited from Inline.) |
![]() ![]() | IsMoveFromRevision |
Returns true if this object was moved (deleted) in Microsoft Word while change tracking was enabled.
(Inherited from Inline.) |
![]() ![]() | IsMoveToRevision |
Returns true if this object was moved (inserted) in Microsoft Word while change tracking was enabled.
(Inherited from Inline.) |
![]() ![]() | NextSibling |
Gets the node immediately following this node.
(Inherited from Node.) |
![]() ![]() | NodeType |
Returns NodeType.SpecialChar.
(Inherited from SpecialChar.) |
![]() ![]() | ParentNode |
Gets the immediate parent of this node.
(Inherited from Node.) |
![]() ![]() | ParentParagraph |
Retrieves the parent Paragraph of this node.
(Inherited from Inline.) |
![]() ![]() | PreviousSibling |
Gets the node immediately preceding this node.
(Inherited from Node.) |
![]() ![]() | Range |
Returns a Range object that represents the portion of a document that is contained in this node.
(Inherited from Node.) |
Name | Description | |
---|---|---|
![]() ![]() | Accept |
Accepts a visitor.
(Overrides SpecialCharAccept(DocumentVisitor).) |
![]() ![]() | Clone | (Inherited from Node.) |
![]() | Equals | (Inherited from Object.) |
![]() ![]() | GetAncestor(Type) |
Gets the first ancestor of the specified object type.
(Inherited from Node.) |
![]() ![]() | GetAncestor(NodeType) |
Gets the first ancestor of the specified NodeType.
(Inherited from Node.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetText |
Gets the special character that this node represents.
(Inherited from SpecialChar.) |
![]() | GetType | (Inherited from Object.) |
![]() ![]() | NextPreOrder |
Gets next node according to the pre-order tree traversal algorithm.
(Inherited from Node.) |
![]() ![]() | PreviousPreOrder |
Gets the previous node according to the pre-order tree traversal algorithm.
(Inherited from Node.) |
![]() ![]() | Remove |
Removes itself from the parent.
(Inherited from Node.) |
![]() | ToString | (Inherited from Object.) |
![]() ![]() | ToString(SaveFormat) |
Exports the content of the node into a string in the specified format.
(Inherited from Node.) |
![]() ![]() | ToString(SaveOptions) |
Exports the content of the node into a string using the specified save options.
(Inherited from Node.) |
public void DocumentToTxt() { // This document contains two sentences separated by an absolute position tab Document doc = new Document(MyDir + "Absolute position tab.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 DocToTxtWriter myDocToTxtWriter = new DocToTxtWriter(); // 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 DocToTxtWriter(); 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 DocToTxtWriter : DocumentVisitor { public DocToTxtWriter() { 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; }