Is there anyway after I have exported my grid, and before I save it to insert a new row at the top of the worksheet that has a long description of what my grid is about? I am using 8.3 about to upgrade to 9.2, but have still not found a way to do this. The description I have is very long and cannot be used at the worksheet or file name because of the need for special characters.Any help or guidance will be greatly appreciated.
Dim x As Integer = 0 Dim name As String Dim exportFile As String Dim workbook As New Infragistics.Excel.Workbook Dim title As String = Me.ParentForm.Text.Replace(":", " ").Replace("\", " ").Replace("/", "-").Replace("?", "").Replace("*", "").Replace("[", "").Replace("]", "").Replace(",", " ").Replace(".", " ").Replace(" ", " ") exportFile = "C:\Documents and Settings\" & Environment.UserName & "\Local settings\Temp\excel.xls" 'exportFile = "C:\Documents and Settings\" & Environment.UserName & "\Local settings\Temp\" & Me.ParentForm.Text & ".xls" For Each obj As Object In UltraGridsForExcel Dim grid As Infragistics.Win.UltraWinGrid.UltraGrid grid = TryCast(obj, Infragistics.Win.UltraWinGrid.UltraGrid) If grid IsNot Nothing Then If grid.Name = "" Then name = x.ToString x = x + 1 Else name = grid.Name End If name = Me.AbbreviateTitle(name) name = name.Replace(":", " ").Replace("\", " ").Replace("/", "-").Replace("?", "").Replace("*", "").Replace("[", "").Replace("]", "").Replace(" ", " ") If name.Length > 31 Then name = name.Substring(0, 31) End If workbook.Worksheets.Add(name) If setPrintOptions Then workbook.WindowOptions.SelectedWorksheet.PrintOptions.MaxPagesHorizontally = 1 workbook.WindowOptions.SelectedWorksheet.PrintOptions.MaxPagesVertically = 1 workbook.WindowOptions.SelectedWorksheet.PrintOptions.Orientation = Infragistics.Excel.Orientation.Landscape workbook.WindowOptions.SelectedWorksheet.PrintOptions.ScalingType = Infragistics.Excel.ScalingType.FitToPages End If ExcelExporter.Export(grid, workbook.Worksheets(name)) End If Next Try workbook.Save(exportFile) Catch exportFile = "C:\Documents and Settings\" & Environment.UserName & "\Local settings\Temp\" & Now.Ticks.ToString & ".xls" workbook.Save(exportFile) End Try Return exportFile
There's some sample code to do this here:
UltraGridExcelExporter - Infragistics Community
Thanks Mike, I did a bunch of different searches, but never came across that post. It was very helpful. Keep up the good work.