Class TextTabStopCollection

TextTabStopCollection class

Represents the list of all tab stops.

public class TextTabStopCollection : CollectionBase<TextTabStop>

Constructors

NameDescription
TextTabStopCollection()The default constructor.

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; }Gets TextTabStop by the index.
Item { get; set; }

Methods

NameDescription
Add(TextTabAlignmentType, double)Adds a tab stop.
BinarySearch(TextTabStop)
BinarySearch(TextTabStop, IComparer<TextTabStop>)
BinarySearch(int, int, TextTabStop, IComparer<TextTabStop>)
Clear()
Contains(TextTabStop)
CopyTo(TextTabStop[])
CopyTo(TextTabStop[], int)
CopyTo(int, TextTabStop[], int, int)
Exists(Predicate<TextTabStop>)
Find(Predicate<TextTabStop>)
FindAll(Predicate<TextTabStop>)
FindIndex(Predicate<TextTabStop>)
FindIndex(int, Predicate<TextTabStop>)
FindIndex(int, int, Predicate<TextTabStop>)
FindLast(Predicate<TextTabStop>)
FindLastIndex(Predicate<TextTabStop>)
FindLastIndex(int, Predicate<TextTabStop>)
FindLastIndex(int, int, Predicate<TextTabStop>)
GetEnumerator()
IndexOf(TextTabStop)
IndexOf(TextTabStop, int)
IndexOf(TextTabStop, int, int)
LastIndexOf(TextTabStop)
LastIndexOf(TextTabStop, int)
LastIndexOf(TextTabStop, int, int)
RemoveAt(int)

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Drawing.Texts;
    using System;

    public class TextsClassTextTabStopCollectionDemo
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Create a text box shape
            var shape = worksheet.Shapes.AddTextBox(1, 0, 1, 0, 300, 100);
            shape.Text = "Left\tCenter\tRight";

            // Get the text paragraph to access tab stops
            var textParagraph = shape.TextBody.TextParagraphs[0];
            var tabStops = textParagraph.Stops;

            // Clear any existing tab stops
            tabStops.Clear();

            // Add tab stops with different alignments
            tabStops.Add(TextTabAlignmentType.Left, 50);
            tabStops.Add(TextTabAlignmentType.Center, 150);
            tabStops.Add(TextTabAlignmentType.Right, 250);

            // Display tab stop information
            Console.WriteLine("Tab Stops Count: " + tabStops.Count);
            for (int i = 0; i < tabStops.Count; i++)
            {
                Console.WriteLine($"Tab {i}: Position={tabStops[i].TabPosition}, Alignment={tabStops[i].TabAlignment}");
            }

            // Save the workbook
            workbook.Save("TextTabStopCollectionDemo.xlsx");
        }
    }
}

See Also