officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-table-dot-foreachrow-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-tablerowprocessordelegate-x29.md
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
void ForEachRow(
TableRowProcessorDelegate cellProcessor
)
Sub ForEachRow(
cellProcessor As TableRowProcessorDelegate
)
| Name | Type | Description |
|---|---|---|
| cellProcessor | TableRowProcessorDelegate |
A TableRowProcessorDelegate delegate.
|
Tip
You can also use anonymous methods as delegates.
The following code snippet paints the third column with a light cyan color.
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;
}
}
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
//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
//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
// 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
// Change cell background color and vertical alignment in the third column.
table.ForEachRow((row, rowIndex)=>
{
word-document-api-table-examples/CS/Program.cs#L269
//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
'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
'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
' 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
' 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
'Call the declared method using ForEachRow method and the corresponding delegate
tbl.ForEachRow(New TableRowProcessorDelegate(AddressOf DeleteCells))
End Sub
See Also