[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ITableRows.Add

Add Method

Add(int)

Adds a new row to the table and returns the newly added ITableRow object.

Declaration
ITableRow Add(int position = -1)
Function Add(Optional position As Integer = -1) As ITableRow
Parameters
Type Name Description
int position

The zero-based position at which to insert the row, or -1 to append it.

Returns
Type Description
ITableRow

The newly added ITableRow object.

Examples
worksheet.Range["A1:B3"].Value = new object[,] {
    {"Name", "Value"},
    {"A", 100},
    {"B", 200}
};
ITable table = worksheet.Tables.Add(worksheet.Range["A1:B3"], true);
ITableRow row = table.Rows.Add();

Add(int, int)

Adds one or more rows to the table at the specified relative position.

The new rows are inserted at the specified zero-based relative position in the table data rows. If position is less than 0 or greater than or equal to the current row count, the new rows are added to the end of the table.

Declaration
void Add(int position, int count)
Sub Add(position As Integer, count As Integer)
Parameters
Type Name Description
int position

A zero-based relative position that specifies where the new row(s) are added.

int count

The number of rows to add.

Examples
worksheet.Range["A1:B3"].Value = new object[,] {
    {"Name", "Value"},
    {"A", 100},
    {"B", 200}
};
ITable table = worksheet.Tables.Add(worksheet.Range["A1:B3"], true);
table.Rows.Add(1, 2);