Dim workbook As New Infragistics.Documents.Excel.Workbook()
Dim worksheet As Infragistics.Documents.Excel.Worksheet = _
workbook.Worksheets.Add("Sheet1")
' Make some column headers
worksheet.Rows.Item(1).Cells.Item(1).Value = "Morning"
worksheet.Rows.Item(1).Cells.Item(2).Value = "Afternoon"
worksheet.Rows.Item(1).Cells.Item(3).Value = "Evening"
' Create a merged region that will be a header to the column headers
Dim mergedRegion1 As Infragistics.Documents.Excel.WorksheetMergedCellsRegion = _
worksheet.MergedCellsRegions.Add(0, 1, 0, 3)
' Set the value of the merged region
mergedRegion1.Value = "Day 1"
' Give the merged region a solid background color
mergedRegion1.CellFormat.FillPattern = _
Infragistics.Documents.Excel.FillPatternStyle.Solid
mergedRegion1.CellFormat.FillPatternForegroundColor = Color.SkyBlue
' Set the cell alignment of the middle cell in the merged region.
' Since a cell and its merged region shared a cell format, this will
' ultimately set the format of the merged region
worksheet.Rows.Item(0).Cells.Item(2).CellFormat.Alignment = _
Infragistics.Documents.Excel.HorizontalCellAlignment.Center