Back to Devexpress

TabInfo Class

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-9656b1ea.md

latest4.1 KB
Original Source

TabInfo Class

A tab stop.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
[ComVisible(true)]
public class TabInfo
vb
<ComVisible(True)>
Public Class TabInfo

Remarks

Use the ParagraphPropertiesWithTabs.BeginUpdateTabs method to get access to the collection of TabInfo objects for the current paragraph and specify their alignment type via the TabInfo.Alignment property.

Note

To specify default tab stop width, use the Document.DefaultTabWidth property.

Example

The code sample below sets the document measurement Document.Unit to inches and specifies tab stops. Tab stops are set and updated for the target paragraph only.

View Example

csharp
using XtraRichEdit.API.Native;
using DevExpress.Office;

using (var wordProcessor = new RichEditDocumentServer())
{
    wordProcessor.LoadDocument("FirstLook.docx");
    Document document = wordProcessor.Document;

    document.Unit = DocumentUnit.Inch;

    // Access first paragraph tabs
    TabInfoCollection tabs = document.Paragraphs[0].BeginUpdateTabs(true);

    // Set the first tab stop at 2.5 inch
    TabInfo tab1 = new TabInfo();
    tab1.Position = 2.5f;
    tab1.Alignment = TabAlignmentType.Left;
    tab1.Leader = TabLeaderType.MiddleDots;
    tabs.Add(tab1);

    // Set the second tab stop at 5.5 inch
    TabInfo tab2 = new TabInfo();
    tab2.Position = 5.5f;
    tab2.Alignment = TabAlignmentType.Decimal;
    tab2.Leader = TabLeaderType.EqualSign;
    tabs.Add(tab2);

    document.Paragraphs[0].EndUpdateTabs(tabs);
}
vb
Imports XtraRichEdit.API.Native
Imports DevExpress.Office

Using wordProcessor = New RichEditDocumentServer()
    wordProcessor.LoadDocument("FirstLook.docx")
    Dim document As Document = wordProcessor.Document

    document.Unit = DocumentUnit.Inch

    ' Access first paragraph tabs
    Dim tabs As TabInfoCollection = document.Paragraphs(0).BeginUpdateTabs(True)

    ' Set the first tab stop at 2.5 inch
    Dim tab1 As New TabInfo()
    tab1.Position = 2.5F
    tab1.Alignment = TabAlignmentType.Left
    tab1.Leader = TabLeaderType.MiddleDots
    tabs.Add(tab1)

    ' Set the second tab stop at 5.5 inch
    Dim tab2 As New TabInfo()
    tab2.Position = 5.5F
    tab2.Alignment = TabAlignmentType.Decimal
    tab2.Leader = TabLeaderType.EqualSign
    tabs.Add(tab2)

    document.Paragraphs(0).EndUpdateTabs(tabs)
End Using

[BeginUpdateTabs] xref:DevExpress.XtraRichEdit.API.Native.Paragraph.BeginUpdateTabs(System.Boolean)

Inheritance

Object TabInfo

See Also

TabInfo Members

BeginUpdateTabs(Boolean)

TabInfoCollection

DefaultTabWidth

Paragraph and Tabs Dialogs

DevExpress.XtraRichEdit.API.Native Namespace