Class ListObject
Contents
[
Hide
]ListObject class
Represents a list object on a worksheet. The ListObject object is a member of the ListObjects collection. The ListObjects collection contains all the list objects on a worksheet.
public class ListObject
Properties
Name | Description |
---|---|
AlternativeDescription { get; set; } | Gets and sets the alternative description. |
AlternativeText { get; set; } | Gets and sets the alternative text. |
AutoFilter { get; } | Gets auto filter. |
Comment { get; set; } | Gets and sets the comment of the table. |
DataRange { get; } | Gets the data range of the ListObject. |
DataSourceType { get; } | Gets the data source type of the table. |
DisplayName { get; set; } | Gets and sets the display name. |
EndColumn { get; } | Gets the end column of the range. |
EndRow { get; } | Gets the end row of the range. |
ListColumns { get; } | Gets ListColumns of the ListObject. |
QueryTable { get; } | Gets the linked QueryTable. |
ShowHeaderRow { get; set; } | Gets and sets whether this ListObject show header row. |
ShowTableStyleColumnStripes { get; set; } | Indicates whether column stripe formatting is applied. |
ShowTableStyleFirstColumn { get; set; } | Indicates whether the first column in the table should have the style applied. |
ShowTableStyleLastColumn { get; set; } | Indicates whether the last column in the table should have the style applied. |
ShowTableStyleRowStripes { get; set; } | Indicates whether row stripe formatting is applied. |
ShowTotals { get; set; } | Gets and sets whether this ListObject show total row. |
StartColumn { get; } | Gets the start column of the range. |
StartRow { get; } | Gets the start row of the range. |
TableStyleName { get; set; } | Gets and sets the table style name. |
TableStyleType { get; set; } | Gets and the built-in table style. |
XmlMap { get; } | Gets an XmlMap used for this list. |
Methods
Name | Description |
---|---|
ApplyStyleToRange() | Apply the table style to the range. |
ConvertToRange() | Convert the table to range. |
ConvertToRange(TableToRangeOptions) | Convert the table to range. |
Filter() | Filter the table. |
PutCellFormula(int, int, string) | Put the formula to the cell in the table. |
PutCellFormula(int, int, string, bool) | Put the formula to the cell in the table. |
PutCellValue(int, int, object) | Put the value to the cell. |
PutCellValue(int, int, object, bool) | Put the value to the cell. |
Resize(int, int, int, int, bool) | Resize the range of the list object. |
UpdateColumnName() | Updates all list columns’ name from the worksheet. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Tables;
using System;
public class ListObjectDemo
{
public static void ListObjectExample()
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
// Populate the worksheet with some data
for (int i = 0; i < 5; i++)
{
cells[0, i].PutValue(CellsHelper.ColumnIndexToName(i));
}
for (int row = 1; row < 10; row++)
{
for (int column = 0; column < 5; column++)
{
cells[row, column].PutValue(row * column);
}
}
// Add a ListObject (table) to the worksheet
ListObjectCollection tables = worksheet.ListObjects;
int index = tables.Add(0, 0, 9, 4, true);
ListObject table = tables[index];
// Set some properties of the ListObject
table.ShowTotals = true;
table.ListColumns[4].TotalsCalculation = TotalsCalculation.Sum;
table.DisplayName = "SampleTable";
table.Comment = "This is a sample table.";
table.ShowTableStyleFirstColumn = true;
table.ShowTableStyleLastColumn = true;
table.ShowTableStyleRowStripes = true;
table.ShowTableStyleColumnStripes = true;
table.TableStyleType = TableStyleType.TableStyleMedium9;
// Save the workbook
workbook.Save("ListObjectExample.xlsx");
}
}
}
See Also
- namespace Aspose.Cells.Tables
- assembly Aspose.Cells