menu

Xamarin.Android

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

    Show / Hide Table of Contents

    Interface ITableStyleElements

    Represents Table Style Elements

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

    Properties

    Count

    Gets the table style Element count from table style elements 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);
          ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
          ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
          int count=tableStyleElements.Count;
    
          workbook.SaveAs("CustomTableStyle.xlsx");
          workbook.Close();
    }

    Item[ExcelTableStyleElementType]

    Gets the table style element from table style elements list collection by using table style element type.

    Declaration
    ITableStyleElement this[ExcelTableStyleElementType tableStyleElementType] { get; }
    Parameters
    Type Name Description
    ExcelTableStyleElementType tableStyleElementType
    Property Value
    Type
    ITableStyleElement
    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;
          ITableStyleElement tableStyleElement1 = tableStyleElements[ExcelTableStyleElementType.HeaderRow];
    
          workbook.SaveAs("CustomTableStyle.xlsx");
          workbook.Close();
    }

    Item[Int32]

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

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

    Methods

    Add(ExcelTableStyleElementType)

    Create the table style element object to add the table style elements list collection and return by using table style element type.

    Declaration
    ITableStyleElement Add(ExcelTableStyleElementType tableStyleElementType)
    Parameters
    Type Name Description
    ExcelTableStyleElementType tableStyleElementType
    Returns
    Type
    ITableStyleElement
    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.FirstColumn); 
    
          workbook.SaveAs("CustomTableStyle.xlsx");
          workbook.Close();
    }

    Add(ITableStyleElement)

    If check the this table style element is already exist in table style element list collection to return related table style element, else this table style element is add to table style element list collection and return.

    Declaration
    ITableStyleElement Add(ITableStyleElement tableStyleElement)
    Parameters
    Type Name Description
    ITableStyleElement tableStyleElement
    Returns
    Type
    ITableStyleElement
    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.FirstColumn);
          tableStyleElement.BackColor=ExcelKnownColors.Blue;
          ITableStyleElement tableStyleElementClone=tableStyleElement.Clone();
    
          MemoryStream stream=new MemoryStream();
          workbook.SaveAs(stream);
          stream.Position=0;
          workbook= application.Workbooks.Open(stream);
          ITableStyles tableStyles1=workbook.TableStyles;
          ITableStyle  tableStyle1 = tableStyles1.Add("Table Style");
          ITableStyleElements tableStyleElements1=tableStyle1.TableStyleElements;
          ITableStyleElement tableStyleElement1=tableStyleElements1.Add(tableStyleElementClone);
          workbook.Close();
    }

    Contains(ExcelTableStyleElementType)

    True if table style element is exist in table style elements list collection. otherwise, False

    Declaration
    bool Contains(ExcelTableStyleElementType tableStyleElementType)
    Parameters
    Type Name Description
    ExcelTableStyleElementType tableStyleElementType
    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);
          ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
          ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
          bool check = tableStyleElements.Contains(ExcelTableStyleElementType.FirstColumn);
    
          workbook.SaveAs("CustomTableStyle.xlsx");
          workbook.Close();
    }

    Contains(ITableStyleElement)

    True if table style element is exist in table style elements list collection. otherwise, False

    Declaration
    bool Contains(ITableStyleElement tableStyleElement)
    Parameters
    Type Name Description
    ITableStyleElement tableStyleElement
    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);
          ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
          ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
          bool check = tableStyleElements.Contains(tableStyleElement);
    
          workbook.SaveAs("CustomTableStyle.xlsx");
          workbook.Close();
    }

    Remove(ITableStyleElement)

    Remove the table style element from table style elements list collection by using table style element object.

    Declaration
    void Remove(ITableStyleElement tableStyleElement)
    Parameters
    Type Name Description
    ITableStyleElement tableStyleElement
    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.FirstColumn);
       tableStyleElements.Remove(tableStyleElement);
    
       workbook.SaveAs("CustomTableStyle.xlsx");
       workbook.Close();
    }

    RemoveAt(Int32)

    Remove the table style element from table style elements list collection 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);
       ITableStyleElements tableStyleElements = tableStyle.TableStyleElements;
       ITableStyleElement tableStyleElement = tableStyleElements.Add(ExcelTableStyleElementType.FirstColumn);
       tableStyleElements.RemoveAt(0);
    
       workbook.SaveAs("CustomTableStyle.xlsx");
       workbook.Close();
    }
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved