Hi,
I have a grid and the grid has colored rows to differentiate. I have hidden the grid and use excel exporter to export to excel. It exports the data correctly and i get the colors in the excel also which is what i want.
However i need a legend just above the header to color a cell and say what it means. Can it be done using any event of excel exporter ? or is there any other way to do it?
Thanks,
Sure. Use the BeginExport event. The event will pass in the WorkSheet that the grid is being exported to. So you can set values or apply styles to any cells you like. Then you just have to update the CurrentRowIndex property on the event args so that the grid export start below the rows you used.
I had a go at it Mike. The CurrentRowIndex is reset to 0 and doesn't show me anything whatever text i'm setting in the cells. I had to increment the row index for Header (HeaderRowExpoting)as well as grid Rows(RowExporting) to get what i want.
Thanks Mike.
I'm not sure I follow you. I tried this out and it works fine for me.
private void ultraGridExcelExporter1_BeginExport(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.BeginExportEventArgs e) { // Write some stuff into the first row of the workbook e.CurrentWorksheet.Rows[0].Cells[0].Value = "This is the first row."; // Set the CurrentRowIndex to 1, instead of 0, so that the grid starts exporting one // row down, and doesn't overwrite the text I added. e.CurrentRowIndex = 1; }