Hi
I am exporting grid data to Microsoft Excel and I need to add extra blank columns and rows in the Excel worksheet. These extra columns and rows do not have data associated with them and are only use to separate the data into blocks.
For example, I have 12 columns of monthly data for a financial quarter so there are 4 columns for January, 4 for February and 4 for March. I have to separate the January/February and February/March data with blank columns.
The rows are data for several categories. I have separate each category with a blank row.
I'm not clear which events and methods I can use generate this output while exporting the grid data with UltraGridCellExporter. I am using version 12.2.
Any help greatly appreciated.
Regards
James O'Doherty, Solution and Database Architect, Landesbank Berlin AG, London
Hello,
In order to insert blank columns only in the exported Excel file you should handle ExportStarted event of UltraGridExcelExporter and to add needed columns to the exported layout. About the blank rows you could add them to the data source before exporting and to remove them when exporting ends. I have implement my suggestion in a small sample, please run the sample and let me know if this is what you are looking for.
Please let me know if you have any further questions.
Hi,
How can we insert extra rows to excel on top after all data has exported to execl from grid in asp.
Hi Patan,
This is pretty easy to do using the events on the UltraGridExcelExporter.
For example, you could handle the ExportStarted event and then write whatever data you want into the worksheet. The event args give you the CurrentWorksheet amnd CurrentRowIndex (and CurrentColumnIndex) and these are settable properties. So you could, for example, write some values to some cells in the worksheet and then adjust the CurrentRowIndex so that is' below the rows you added. The exporter will then export the grid starting at the row you specified.
Similarly, you could use ExportEnded to get the worksheet and just write whatever you want by writing to rows that are beyond the CurrentRowIndex.