menu

Xamarin.Android

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

    Show / Hide Table of Contents

    Class WCellCollection

    Represents a collection of WTableCell in the WTableRow.

    Inheritance
    System.Object
    OwnerHolder
    CollectionImpl
    EntityCollection
    WCellCollection
    Implements
    IEntityCollectionBase
    ICollectionBase
    System.Collections.IEnumerable
    Inherited Members
    CollectionImpl.Count
    CollectionImpl.GetEnumerator()
    EntityCollection.Add(IEntity)
    EntityCollection.Clear()
    EntityCollection.Contains(IEntity)
    EntityCollection.FirstItem
    EntityCollection.IndexOf(IEntity)
    EntityCollection.Insert(Int32, IEntity)
    EntityCollection.LastItem
    EntityCollection.OnInsert(Int32, Entity)
    EntityCollection.OnInsertComplete(Int32, Entity)
    EntityCollection.OnRemove(Int32)
    EntityCollection.Remove(IEntity)
    OwnerHolder.Document
    OwnerHolder.m_doc
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Portable.dll
    Syntax
    public class WCellCollection : EntityCollection, IEntityCollectionBase, ICollectionBase, IEnumerable
    Examples
    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document
        WordDocument document = new WordDocument();
        //Add new section
        IWSection section = document.AddSection();
        //Add new paragraph
        section.AddParagraph().AppendText("Price Details");
        section.AddParagraph();
        //Add a new table into Word document
        IWTable table = section.AddTable();
        //Add the first row into table
        WTableRow row = table.AddRow();
        //Create a new cell 
        WTableCell cell = new WTableCell(document);
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("Item");
        //Add the cell to the cells collection.
        row.Cells.Add(cell);
        int index = row.Cells.IndexOf(cell);
        //Create a new cell 
        cell = new WTableCell(document);
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("Price($)");
        //Add the cell to the cells collection.
        row.Cells.Insert(index + 1, cell);
        //Add the second row into table
        row = table.AddRow(true, false);
        //Add the first cell into second row
        cell = row.AddCell();
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("Apple");
        //Add the second cell into second row
        cell = row.AddCell();
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("50");
        //Add the third row into table
        row = table.AddRow(true, false);
        //Add the first cell into third row 
        cell = row.AddCell();
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("Orange");
        //Add the second cell into third row 
        cell = row.AddCell();
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("30");
        //Add the third cell into third row
        cell = row.AddCell();
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("Banana");
        //Removes the specified cell.
        row.Cells.Remove(cell);
        //Save and close the document
        document.Save("Table.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Create a new Word document
        Dim document As New WordDocument()
        'Add new section
        Dim section As IWSection = document.AddSection()
        'Add new paragraph
        section.AddParagraph().AppendText("Price Details")
        section.AddParagraph()
        'Add a new table into Word document
        Dim table As IWTable = section.AddTable()
        'Add the first row into table
        Dim row As WTableRow = table.AddRow()
        'Create a new cell 
        Dim cell As New WTableCell(document)
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("Item")
        'Add the cell to the cells collection.
        row.Cells.Add(cell)
        Dim index As Integer = row.Cells.IndexOf(cell)
        'Create a new cell 
        cell = New WTableCell(document)
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("Price($)")
        'Add the cell to the cells collection.
        row.Cells.Insert(index + 1, cell)
        'Add the second row into table
        row = table.AddRow(True, False)
        'Add the first cell into second row
        cell = row.AddCell()
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("Apple")
        'Add the second cell into second row
        cell = row.AddCell()
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("50")
        'Add the third row into table
        row = table.AddRow(True, False)
        'Add the first cell into third row 
        cell = row.AddCell()
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("Orange")
        'Add the second cell into third row 
        cell = row.AddCell()
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("30")
        'Add the third cell into third row
        cell = row.AddCell()
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("Banana")
        'Removes the specified cell.
        row.Cells.Remove(cell)
        'Save and close the document
        document.Save("Table.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    WCellCollection(WTableRow)

    Initializes a new instance of the WCellCollection class with the specified WTableRow instance.

    Declaration
    public WCellCollection(WTableRow owner)
    Parameters
    Type Name Description
    WTableRow owner

    The WTableRow to has this cell collection.

    Properties

    Item[Int32]

    Gets the WTableCell at the specified index.

    Declaration
    public WTableCell this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based index of the WTableCell to get.

    Property Value
    Type Description
    WTableCell

    The WTableCell at the specified index.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    The index is not valid in the WCellCollection.

    TypesOfElement

    Gets the type of the elements present in the collection.

    Declaration
    protected override Type[] TypesOfElement { get; }
    Property Value
    Type Description
    System.Type[]

    The System.Type collection that contains the types of the elements.

    Overrides
    EntityCollection.TypesOfElement

    Methods

    Add(WTableCell)

    Adds the specified WTableCell to the WCellCollection.

    Declaration
    public int Add(WTableCell cell)
    Parameters
    Type Name Description
    WTableCell cell

    The WTableCell to be added.

    Returns
    Type Description
    System.Int32

    The zero-based index of the cell.

    Exceptions
    Type Condition
    System.ArgumentException

    The number of cells must be between 1 and 63.

    IndexOf(WTableCell)

    Returns the index of a specified WTableCell in the collection.

    Declaration
    public int IndexOf(WTableCell cell)
    Parameters
    Type Name Description
    WTableCell cell

    The WTableCell to find the index.

    Returns
    Type Description
    System.Int32

    The zero-based index of the specified cell.

    Insert(Int32, WTableCell)

    Inserts a specified WTableCell at the specified index in collection.

    Declaration
    public void Insert(int index, WTableCell cell)
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based index to insert the cell.

    WTableCell cell

    The WTableCell to be inserted.

    OnClear()

    Removes all the items from the collection.

    Declaration
    protected override void OnClear()
    Overrides
    EntityCollection.OnClear()

    Remove(WTableCell)

    Removes the specified WTableCell from the collection.

    Declaration
    public void Remove(WTableCell cell)
    Parameters
    Type Name Description
    WTableCell cell

    The WTableCell to be removed from the collection.

    RemoveAt(Int32)

    Removes the WTableCell at the specified index from the collection.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The zero-based index of the cell.

    Implements

    IEntityCollectionBase
    ICollectionBase
    System.Collections.IEnumerable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved