menu

Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface ITableStyles - Xamarin.Android API Reference | Syncfusion

    Show / Hide Table of Contents

    Interface ITableStyles

    Represents Table Styles

    Namespace: Syncfusion.XlsIO
    Assembly: Syncfusion.XlsIO.Portable.dll
    Syntax
    public interface ITableStyles : IEnumerable

    Properties

    Count

    Gets the table style count from table styles list collection.

    Declaration
    int Count { get; }
    Property Value
    Type
    System.Int32
    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");
       int count=tableStyles.Count;
       workbook.SaveAs("CustomTableStyle.xlsx");
       workbook.Close();
    }

    Item[Int32]

    Gets the table style from table style list collection by using index value.

    Declaration
    ITableStyle this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    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 tableStyle2=tableStyles[0];
       workbook.SaveAs("CustomTableStyle.xlsx");
    
       workbook.Close();
    }

    Item[String]

    Gets the table style from table style list collection by using table style name.

    Declaration
    ITableStyle this[string tableStyleName] { get; }
    Parameters
    Type Name Description
    System.String tableStyleName
    Property Value
    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 tableStyle2=tableStyles[name];
       workbook.SaveAs("CustomTableStyle.xlsx");
    
       workbook.Close();
    }

    Methods

    Add(ITableStyle)

    Check this table style is already exist or not. This table style was not exists from table style list collection, Add this table style to table styles list collection and return.

    Declaration
    ITableStyle Add(ITableStyle tableStyle)
    Parameters
    Type Name Description
    ITableStyle tableStyle
    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);
       ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
       ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.HeaderRow);
       tableStyleElement.BackColor=ExcelKnownColors.Red;
       ITableStyle tableStyleClone= tableStyle.Clone();
    
       MemoryStream stream = new MemoryStream();
       workbook.SaveAs(stream);
       stream.Position=0;
       IWorkbook workbook1 = application.Workbooks.Open(stream);
       ITableStyles tableStyles1 = workbook1.TableStyles;
       ITableStyle tableStyle1 = tableStyles1.Add(tableStyleClone);
    
       workbook.Close();
    }

    Add(String)

    Create table style class object to set the table style name and add the table style list Collection and return table style.

    Declaration
    ITableStyle Add(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");
    
       workbook.SaveAs("CustomTableStyle.xlsx");
       workbook.Close();
    }

    Contains(ITableStyle)

    True, If tabl style is exist in table styles collection. otherwise, False.

    Declaration
    bool Contains(ITableStyle tableStyle)
    Parameters
    Type Name Description
    ITableStyle tableStyle
    Returns
    Type
    System.Boolean
    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");
       bool check=tableStyles.Contains(tableStyle);
       workbook.SaveAs("CustomTableStyle.xlsx");
    
       workbook.Close();
    }

    Contains(String)

    True, If tabl style name is exist in table styles collection. otherwise, False.

    Declaration
    bool Contains(string tableStyleName)
    Parameters
    Type Name Description
    System.String tableStyleName

    Name of the table style

    Returns
    Type
    System.Boolean
    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");
       bool check=tableStyles.Contains(name);
       workbook.SaveAs("CustomTableStyle.xlsx");
    
       workbook.Close();
    }

    Remove(ITableStyle)

    Remove the table style from table Style list Collection using table style object.

    Declaration
    void Remove(ITableStyle tableStyle)
    Parameters
    Type Name Description
    ITableStyle tableStyle
    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");
       tableStyles.Remove(tableStyle);
       workbook.SaveAs("CustomTableStyle.xlsx");
    
       workbook.Close();
    }

    RemoveAt(Int32)

    Remove the table style from table Style list Collection by using index value.

    Declaration
    void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index
    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");
       tableStyles.RemoveAt(0);
       workbook.SaveAs("CustomTableStyle.xlsx");
    
       workbook.Close();
    }
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved