Dim myWorkbook As Infragistics.Documents.Excel.Workbook = ExcelExampleTable.CreateExampleWorkbook()
Dim table As Infragistics.Documents.Excel.WorksheetTable = myWorkbook.GetTable("Patients")
Dim lastRow As Integer = table.DataAreaRegion.LastRow
Dim rand As New Random()
Dim i As Integer = 1
While i < lastRow
If rand.[Next](2) = 1 Then
myWorkbook.Worksheets(0).Rows(i).Cells(0).CellFormat.Fill = Infragistics.Documents.Excel.CellFill.CreateSolidFill(System.Drawing.Color.FromArgb(255, 255, 0, 0))
End If
i += 1
End While
Dim filterFill As Infragistics.Documents.Excel.CellFill = Infragistics.Documents.Excel.CellFill.CreateSolidFill(System.Drawing.Color.FromArgb(255, 255, 0, 0))
Dim fillSortCondition As New Infragistics.Documents.Excel.Sorting.FillSortCondition(filterFill, Infragistics.Documents.Excel.Sorting.SortDirection.Ascending)
table.Columns(0).SortCondition = fillSortCondition
myWorkbook.Save("C:\TableSorting-Sorted.xlsx")