Interface ITableStyle
Represents Table Style
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface ITableStyle
Properties
Name
Gets the table style name.
Declaration
string Name { get; }
Property Value
Type |
---|
System.String |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyle tableStyle1 = tableStyles.Add("Table style 5");
string tableStyleName = tableStyles[0].Name;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
TableStyleElements
Create the table style elements object and return.
Declaration
ITableStyleElements TableStyleElements { get; }
Property Value
Type |
---|
ITableStyleElements |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyle tableStyle1 = tableStyles.Add("Table style 5");
ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Methods
Clone()
Clone the table style and return.
Declaration
ITableStyle Clone()
Returns
Type |
---|
ITableStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyle tableStyle1 = tableStyles.Add("Table style 5");
ITableStyle tableStyleClone = tableStyle.Clone();
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Delete()
Delete the table style from table styles list collection.
Declaration
void Delete()
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyle tableStyle1 = tableStyles.Add("Table style 5");
tableStyle.Delete();
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Duplicate()
Clone the table style to add the table styles list collection and return.
Declaration
ITableStyle Duplicate()
Returns
Type |
---|
ITableStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyle tableStyle1 = tableStyles.Add("Table style 5");
ITableStyle tableStyleDuplicate = tableStyle.Duplicate();
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}
Duplicate(String)
Clone the table style to add the table styles list collection and return.
Declaration
ITableStyle Duplicate(string tableStyleName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tableStyleName |
Returns
Type |
---|
ITableStyle |
Examples
using(ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
string name = "Table Style 4";
ITableStyles tableStyles = workbook.TableStyles;
ITableStyle tableStyle = tableStyles.Add(name);
ITableStyle tableStyle1 = tableStyles.Add("Table style 5");
ITableStyle tableStyleDuplicate= tableStyle.Duplicate(name);
workbook.SaveAs("CustomTableStyle.xlsx");
workbook.Close();
}