Class TextBoxCollection
Contents
[
Hide
]TextBoxCollection class
Encapsulates a collection of TextBox objects.
public class TextBoxCollection : CollectionBase<TextBox>
Properties
| Name | Description |
|---|---|
| Capacity { get; set; } | |
| Count { get; } | |
| Item { get; } | Gets the TextBox element at the specified index. (2 indexers) |
| Item { get; set; } |
Methods
| Name | Description |
|---|---|
| Add(int, int, int, int) | Adds a textbox to the collection. |
| BinarySearch(TextBox) | |
| BinarySearch(TextBox, IComparer<TextBox>) | |
| BinarySearch(int, int, TextBox, IComparer<TextBox>) | |
| Clear() | Clear all text boxes. (2 methods) |
| Contains(TextBox) | |
| CopyTo(TextBox[]) | |
| CopyTo(TextBox[], int) | |
| CopyTo(int, TextBox[], int, int) | |
| Exists(Predicate<TextBox>) | |
| Find(Predicate<TextBox>) | |
| FindAll(Predicate<TextBox>) | |
| FindIndex(Predicate<TextBox>) | |
| FindIndex(int, Predicate<TextBox>) | |
| FindIndex(int, int, Predicate<TextBox>) | |
| FindLast(Predicate<TextBox>) | |
| FindLastIndex(Predicate<TextBox>) | |
| FindLastIndex(int, Predicate<TextBox>) | |
| FindLastIndex(int, int, Predicate<TextBox>) | |
| GetEnumerator() | |
| IndexOf(TextBox) | |
| IndexOf(TextBox, int) | |
| IndexOf(TextBox, int, int) | |
| LastIndexOf(TextBox) | |
| LastIndexOf(TextBox, int) | |
| LastIndexOf(TextBox, int, int) | |
| RemoveAt(int) | Remove a text box from the file. (2 methods) |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Drawing;
using System;
public class TextBoxCollectionDemo
{
public static void TextBoxCollectionExample()
{
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Get the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Get the TextBoxCollection object
TextBoxCollection textBoxCollection = worksheet.TextBoxes;
// Add a TextBox to the collection
int textBoxIndex = textBoxCollection.Add(1, 1, 50, 100);
// Access the added TextBox
TextBox textBox = textBoxCollection[textBoxIndex];
// Set some properties of the TextBox
textBox.Text = "Hello, Aspose!";
textBox.Font.Name = "Arial";
textBox.Font.Size = 12;
textBox.Font.IsBold = true;
// Iterate through all TextBoxes in the collection
foreach (TextBox tbox in textBoxCollection)
{
// Perform operations on each TextBox
Console.WriteLine(tbox.Text);
}
// Save the workbook
workbook.Save("TextBoxCollectionExample.xlsx");
}
}
}
See Also
- class CollectionBase<T>
- class TextBox
- namespace Aspose.Cells.Drawing
- assembly Aspose.Cells