Here is a small sample of some of my code using Infragistics WebGrid and Aspose.Excel:
iNumRows = Me.UltraWebGrid1.Rows.Count - 1
For iLoop = 1 To iNumRows
oSheet.Cells.InsertRow(10)
Next
oCell = oSheet.Cells(0, 0)
If bIndividual = False Then
oCell.PutValue("Clinical Physician Profile - " & Session("s_sDiseaseName") & " - " & Session("s_sPeriodBegins") & " to " & Session("s_sPeriodEnds"))
Else
oCell.PutValue("Blinded Clinical Physician Profile - " & Session("s_sDiseaseName") & " - " & Session("s_sPeriodBegins") & " to " & Session("s_sPeriodEnds"))
End If
oCell.Style.HorizontalAlignment = TextAlignmentType.Left
oCell.Style.IndentLevel = 3
iCol = 5
iRow = 8
For iLoop = 5 To (UltraWebGrid1.Columns.Count - 1)
sColor = UltraWebGrid1.Columns(iLoop).HeaderStyle.BackColor
Select Case sColor.Name
Case "LightSalmon"
iClin = iClin + 1
Case "Gold"
iFin = iFin + 1
Case "MediumSpringGreen"
iQual = iQual + 1
End Select
Next
oSheet.Cells.Merge(7, 5, 1, iClin)
oCell = oSheet.Cells(7, 5)
oCell.PutValue("Clinical Issues")
oSheet.Cells.Merge(7, 5 + iClin, 1, iFin)
oCell = oSheet.Cells(7, 5 + iClin)
oCell.PutValue("Financial Issues")
oSheet.Cells.Merge(7, 5 + iClin + iFin, 1, iQual)
oCell = oSheet.Cells(7, 5 + iClin + iFin)
oCell.PutValue("Quality of Care Issues")
For iLoop = 5 To (UltraWebGrid1.Columns.Count - 1)
'sColor = UltraWebGrid1.Columns(iLoop).HeaderStyle.BackColor
sVal = UltraWebGrid1.Columns(iLoop).HeaderText
oCell = oSheet.Cells(iRow, iCol)
oCell.PutValue(sVal)
iCol = iCol + 1
Next
iRow = 9
For iLoop = 0 To UltraWebGrid1.Rows.Count - 1
For iLoop2 = 0 To UltraWebGrid1.Columns.Count - 1
oCell = oSheet.Cells(iRow, iLoop2)
If iLoop2 = 3 Then
oCell.PutValue(FormatNumber(CDbl(UltraWebGrid1.Rows(iRow - 9).Cells(iLoop2).Text), 2))
ElseIf iLoop2 = 4 Then
oCell.PutValue(CInt(UltraWebGrid1.Rows(iRow - 9).Cells(iLoop2).Text))
Else
oCell.PutValue(UltraWebGrid1.Rows(iRow - 9).Cells(iLoop2).Text)
End If
If iLoop2 = 1 Then
oCell.Style = oExcel.Styles("LeftAlignCellBox")
Else
oCell.Style = oExcel.Styles("RegularCellBox")
End If
Next
iRow = iRow + 1
Next
Hope it helps!
Rick Schoenborn