Back to Devexpress

TableRowProcessorDelegate Delegate

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-26995493.md

latest3.0 KB
Original Source

TableRowProcessorDelegate Delegate

A delegate intended to invoke its method for each row in a table.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
[ComVisible(true)]
public delegate void TableRowProcessorDelegate(
    TableRow row,
    int rowIndex
);
vb
<ComVisible(True)>
Public Delegate Sub TableRowProcessorDelegate(
    row As TableRow,
    rowIndex As Integer
)

Parameters

NameTypeDescription
rowTableRow

A TableRow object that is the row for which the delegate is executed.

| | rowIndex | Int32 |

An integer that is the index of a row in a table.

|

Remarks

Use the Table.ForEachRow method to employ the TableRowProcessorDelegate instance.

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

See Also

DevExpress.XtraRichEdit.API.Native Namespace