Format a List Object - Table

Formatting a List Object

Aspose.Cells provides a class, Workbook, that represents a Microsoft Excel file. The Workbook class contains a Worksheets collection that allows access to each worksheet in an Excel file.

A worksheet is represented by the Worksheet class. The Worksheet class provides a wide range of properties and methods for managing worksheets. To create a ListObject in a worksheet, use ListObjects collection property of the Worksheet class. Each ListObject is, in fact, an object of the ListObjectCollection class, which further provides the add method to add a List object and specify the range of cells it should encompass. According to the specified range of cells, a ListObject is created in the worksheet by Aspose.Cells. Use attributes (for example, TableStyleType) of the ListObject class to format the table for your requirement.

The example below adds sample data to a worksheet, adds a ListObject and applies default styles to it. ListObject styles are supported by Microsoft Excel 2007/2010.

The following output is generated when the code is executed.

A formatted table is created in the worksheet