In DsExcel .NET, you can create custom table style elements and apply them to your worksheet using the ITableStyle Interface. Also, you can format a table using any of the predefined table styles provided by DsExcel .NET.
Typically, each workbook possesses an ITableStyle collection that is used to store both built-in and custom table styles. If you want to insert a custom table style, you use the Add method of the ITables interface, which returns the IStyle object representing the corresponding table style instance.
C# |
Copy Code |
---|---|
//Use table style name get one build in table style. ITableStyle tableStyle = workbook.TableStyles["TableStyleLight11"]; worksheet.Tables.Add(worksheet.Range[0, 0, 2, 2], true); //set build in table style to table. worksheet.Tables[0].TableStyle = tableStyle; |