menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class WRowCollection - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class WRowCollection

    Represents a collection of WTableRow objects.

    Inheritance
    System.Object
    OwnerHolder
    CollectionImpl
    XDLSSerializableCollection
    EntityCollection
    WRowCollection
    Implements
    IXDLSSerializableCollection
    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.OnClear()
    EntityCollection.OnInsert(Int32, Entity)
    EntityCollection.OnInsertComplete(Int32, Entity)
    EntityCollection.OnRemove(Int32)
    EntityCollection.Remove(IEntity)
    EntityCollection.RemoveAt(Int32)
    OwnerHolder.Document
    OwnerHolder.m_doc
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    XDLSSerializableCollection.IXDLSSerializableCollection.AddNewItem(IXDLSContentReader)
    XDLSSerializableCollection.IXDLSSerializableCollection.TagItemName
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Base.dll
    Syntax
    public class WRowCollection : EntityCollection, IXDLSSerializableCollection, IEntityCollectionBase, ICollectionBase, IEnumerable
    Examples
    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document
        WordDocument document = new WordDocument();
        IWSection section = document.AddSection();
        section.AddParagraph().AppendText("Price Details");
        section.AddParagraph();
        //Add a new table into Word document
        IWTable table = section.AddTable();
        //Get the rows collection from table
        WRowCollection rowCollection = table.Rows;            
        //Add the first row into table
        WTableRow row = new WTableRow(document);
        //Add the first cell into first row 
        WTableCell cell = row.AddCell();
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("Item");
        //Add the second cell into first row 
        cell = row.AddCell();
        //Specify the cell width
        cell.Width = 200;
        cell.AddParagraph().AppendText("Price($)");
        //Add row to the collection
        rowCollection.Add(row);
        //Add the second row into table
        row = new WTableRow(document);
        //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");
        //Insert row at index 1
        rowCollection.Insert(1, row);
        //Add the third row into table
        row = new WTableRow(document);
        //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");
        //Insert row
        rowCollection.Insert(2, row);
        //Remove row at index 0.
        rowCollection.RemoveAt(0);
        document.Save("Sample.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()
        Dim section As IWSection = document.AddSection()
        section.AddParagraph().AppendText("Price Details")
        section.AddParagraph()
        'Add a new table into Word document
        Dim table As IWTable = section.AddTable()
        'Get the rows collection from table
        Dim rowCollection As WRowCollection = table.Rows
        'Add the first row into table
        Dim row As New WTableRow(document)
        'Add the first cell into first row 
        Dim cell As WTableCell = row.AddCell()
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("Item")
        'Add the second cell into first row 
        cell = row.AddCell()
        'Specify the cell width
        cell.Width = 200
        cell.AddParagraph().AppendText("Price($)")
        'Add row to the collection
        rowCollection.Add(row)
        'Add the second row into table
        row = New WTableRow(document)
        '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")
        'Insert row at index 1
        rowCollection.Insert(1, row)
        'Add the third row into table
        row = New WTableRow(document)
        '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")
        'Insert row
        rowCollection.Insert(2, row)
        'Remove row at index 0.
        rowCollection.RemoveAt(0)
        document.Save("Sample.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    WRowCollection(WTable)

    Initializes a new instance of the WRowCollection class with the specified WTable instance.

    Declaration
    public WRowCollection(WTable owner)
    Parameters
    Type Name Description
    WTable owner

    The WTable instance.

    Properties

    Item[Int32]

    Gets the table row at the specified index.

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

    The zero-based index of the row to get from the collection.

    Property Value
    Type Description
    WTableRow

    The WTableRow at the specified index.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    The index is not valid in the WRowCollection.

    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(WTableRow)

    Adds the specified table row to the collection.

    Declaration
    public int Add(WTableRow row)
    Parameters
    Type Name Description
    WTableRow row

    The row.

    Returns
    Type
    System.Int32

    CreateItem(IXDLSContentReader)

    Creates new item.

    Declaration
    protected override OwnerHolder CreateItem(IXDLSContentReader reader)
    Parameters
    Type Name Description
    IXDLSContentReader reader

    The IXDLSContentReader instance.

    Returns
    Type Description
    OwnerHolder

    The OwnerHolder instance.

    Overrides
    XDLSSerializableCollection.CreateItem(IXDLSContentReader)

    GetTagItemName()

    Gets the name of xml tag.

    Declaration
    protected override string GetTagItemName()
    Returns
    Type Description
    System.String

    The string that specifies the tag name.

    Overrides
    XDLSSerializableCollection.GetTagItemName()

    IndexOf(WTableRow)

    Returns the index of the specified row in the collection.

    Declaration
    public int IndexOf(WTableRow row)
    Parameters
    Type Name Description
    WTableRow row

    The row.

    Returns
    Type
    System.Int32

    Insert(Int32, WTableRow)

    Inserts the specified table row at the specified index in the collection.

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

    The index.

    WTableRow row

    The row.

    Remove(WTableRow)

    Removes the specified row from the collection.

    Declaration
    public void Remove(WTableRow row)
    Parameters
    Type Name Description
    WTableRow row

    The row.

    Implements

    IXDLSSerializableCollection
    IEntityCollectionBase
    ICollectionBase
    System.Collections.IEnumerable

    Extension Methods

    FunctionalExtensions.ForEach<T>(IEnumerable, Action<T>)
    FunctionalExtensions.ToList<T>(IEnumerable)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved