Class ListObjectCollection
Contents
[
Hide
]ListObjectCollection class
Represents a collection of ListObject
objects in the worksheet.
public class ListObjectCollection : CollectionBase<ListObject>
Properties
Name | Description |
---|---|
Capacity { get; set; } | |
Count { get; } | |
Item { get; } | Gets the ListObject by index. (2 indexers) |
Item { get; set; } |
Methods
Name | Description |
---|---|
Add(string, string, bool) | Adds a ListObject to the worksheet. |
Add(int, int, int, int, bool) | Adds a ListObject to the worksheet. |
BinarySearch(ListObject) | |
BinarySearch(ListObject, IComparer<ListObject>) | |
BinarySearch(int, int, ListObject, IComparer<ListObject>) | |
Clear() | |
Contains(ListObject) | |
CopyTo(ListObject[]) | |
CopyTo(ListObject[], int) | |
CopyTo(int, ListObject[], int, int) | |
Exists(Predicate<ListObject>) | |
Find(Predicate<ListObject>) | |
FindAll(Predicate<ListObject>) | |
FindIndex(Predicate<ListObject>) | |
FindIndex(int, Predicate<ListObject>) | |
FindIndex(int, int, Predicate<ListObject>) | |
FindLast(Predicate<ListObject>) | |
FindLastIndex(Predicate<ListObject>) | |
FindLastIndex(int, Predicate<ListObject>) | |
FindLastIndex(int, int, Predicate<ListObject>) | |
GetEnumerator() | |
IndexOf(ListObject) | |
IndexOf(ListObject, int) | |
IndexOf(ListObject, int, int) | |
LastIndexOf(ListObject) | |
LastIndexOf(ListObject, int) | |
LastIndexOf(ListObject, int, int) | |
RemoveAt(int) | |
UpdateColumnName() | Update all column name of the tables. |
Examples
[C#]
namespace Demos
{
using Aspose.Cells;
using Aspose.Cells.Tables;
using System;
public class ListObjectCollectionDemo
{
public static void ListObjectCollectionExample()
{
// Create a new workbook
Workbook workbook = new Workbook();
// Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Access the ListObjectCollection of the worksheet
ListObjectCollection listObjects = worksheet.ListObjects;
// Add a ListObject (table) to the worksheet
int listObjectIndex = listObjects.Add(0, 0, 10, 4, true);
ListObject listObject = listObjects[listObjectIndex];
// Set the name of the ListObject
listObject.DisplayName = "SampleTable";
// Populate the table with some data
worksheet.Cells["A1"].PutValue("Header1");
worksheet.Cells["B1"].PutValue("Header2");
worksheet.Cells["C1"].PutValue("Header3");
worksheet.Cells["D1"].PutValue("Header4");
for (int i = 1; i <= 10; i++)
{
worksheet.Cells[i, 0].PutValue("Row" + i + "Col1");
worksheet.Cells[i, 1].PutValue("Row" + i + "Col2");
worksheet.Cells[i, 2].PutValue("Row" + i + "Col3");
worksheet.Cells[i, 3].PutValue("Row" + i + "Col4");
}
// Update all column names of the tables
listObjects.UpdateColumnName();
// Save the workbook
workbook.Save("ListObjectCollectionExample.xlsx");
return;
}
}
}
See Also
- class CollectionBase<T>
- class ListObject
- namespace Aspose.Cells.Tables
- assembly Aspose.Cells