Back to Devexpress

Table.ForEachRow(TableRowProcessorDelegate) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-table-dot-foreachrow-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-tablerowprocessordelegate-x29.md

latest7.7 KB
Original Source

Table.ForEachRow(TableRowProcessorDelegate) Method

Enables you to specify a delegate which will be executed for each row of a table.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void ForEachRow(
    TableRowProcessorDelegate cellProcessor
)
vb
Sub ForEachRow(
    cellProcessor As TableRowProcessorDelegate
)

Parameters

NameTypeDescription
cellProcessorTableRowProcessorDelegate

A TableRowProcessorDelegate delegate.

|

Remarks

Tip

You can also use anonymous methods as delegates.

Example

The following code snippet paints the third column with a light cyan color.

View Example

csharp
Table table = document.Tables.Create(document.Range.Start, 3, 10);
table.BeginUpdate();

// Change cell background color and vertical alignment in the third column.
table.ForEachRow(new TableRowProcessorDelegate(ChangeColumnAppearanceHelper.ChangeColumnColor));
table.EndUpdate();

class ChangeColumnAppearanceHelper
{
    public static void ChangeColumnColor(TableRow row, int rowIndex)
    {
        row[2].BackgroundColor = System.Drawing.Color.LightCyan;
        row[2].VerticalAlignment = TableCellVerticalAlignment.Center;
    }
}
vb
Dim table As Table = document.Tables.Create(document.Range.Start, 3, 10)
table.BeginUpdate()

'Change cell background color and vertical alignment in the third column.
table.ForEachRow(New TableRowProcessorDelegate(AddressOf ChangeColumnAppearanceHelper.ChangeColumnColor))
table.EndUpdate()

Private Class ChangeColumnAppearanceHelper
    Public Shared Sub ChangeColumnColor(ByVal row As TableRow, ByVal rowIndex As Integer)
        row(2).BackgroundColor = System.Drawing.Color.LightCyan
        row(2).VerticalAlignment = TableCellVerticalAlignment.Center
    End Sub
End Class

The following code snippets (auto-collected from DevExpress Examples) contain references to the ForEachRow(TableRowProcessorDelegate) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Table.cs#L185

csharp
//Change cell background color and vertical alignment in the third column.
table.ForEachRow(new TableRowProcessorDelegate(ChangeColumnAppearanceHelper.ChangeColumnColor));
table.EndUpdate();

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/TableActions.cs#L153

csharp
//Change cell background color and vertical alignment in the third column.
table.ForEachRow(new TableRowProcessorDelegate(ChangeColumnAppearanceHelper.ChangeColumnColor));
table.EndUpdate();

winforms-richedit-tables-simple-example/CS/TablesSimpleExample/Form1.cs#L257

csharp
// Call the declared method using ForEachRow method and the corresponding delegate
    table.ForEachRow(new TableRowProcessorDelegate(DeleteCells));
}

word-document-api-examples/CS/CodeExamples/TablesActions.cs#L266

csharp
// Change cell background color and vertical alignment in the third column.
table.ForEachRow((row, rowIndex)=>
{

word-document-api-table-examples/CS/Program.cs#L269

csharp
//Call the declared method using ForEachRow method and the corresponding delegate
    tbl.ForEachRow(new TableRowProcessorDelegate(DeleteCells));
}

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Table.vb#L164

vb
'Change cell background color and vertical alignment in the third column.
table.ForEachRow(New DevExpress.XtraRichEdit.API.Native.TableRowProcessorDelegate(AddressOf RichEditAPISample.CodeExamples.TableActions.ChangeColumnAppearanceHelper.ChangeColumnColor))
table.EndUpdate()

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/TableActions.vb#L137

vb
'Change cell background color and vertical alignment in the third column.
table.ForEachRow(New TableRowProcessorDelegate(AddressOf ChangeColumnAppearanceHelper.ChangeColumnColor))
table.EndUpdate()

winforms-richedit-tables-simple-example/VB/TablesSimpleExample/Form1.vb#L207

vb
' Call the declared method using ForEachRow method and the corresponding delegate
    table.ForEachRow(New TableRowProcessorDelegate(AddressOf DeleteCells))
End Sub

word-document-api-examples/VB/CodeExamples/TablesActions.vb#L229

vb
' Change cell background color and vertical alignment in the third column.
table.ForEachRow(
    Sub(row As TableRow, rowIndex As Integer)

word-document-api-table-examples/VB/Program.vb#L216

vb
'Call the declared method using ForEachRow method and the corresponding delegate
    tbl.ForEachRow(New TableRowProcessorDelegate(AddressOf DeleteCells))
End Sub

See Also

ForEachCell(TableCellProcessorDelegate)

Table Interface

Table Members

DevExpress.XtraRichEdit.API.Native Namespace