Hi,
I am using Infragistics netadvantage 11.2 version and using Ultragrid in my one of the form. I am using
ultraGridExcelExporter.Export(MyUltragridObject, saveFileDialog.FileName, Infragistics.Documents.Excel.WorkbookFormat.Excel2007);
This is working fine. Now I want an additional column to be exported that is not in the Ultragrid. How I can add that while exporting so that in the Output excel I will get that additional column.
Regards,Girish
Boris, I was very optimistic when I found this post, but my issue is a bit different: I have an Ultragrid where each row spans multiple rows in the layout. How can I export my grid into an Excel file as a single row using UltragridExcelExporter?
Thank you,
Irena
Thanks very much Boris, this resolved my issue.
Hi Girish,
Please try with the following code:
private void ultraGridExcelExporter1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.ExcelExportInitializeRowEventArgs e)
{
e.Row.Cells["Coll1"].Value = e.Row.Cells["A"].Value.ToString() + e.Row.Cells["B"].Value.ToString();
}
Please do not hesitate to ask if something comes up.
Hi Boris,
Thanks for the solution. This is what I want. Now one more thing is that how do I assign values to this column. Actually the additional column I am going to add to my grid will be based on some calculation of some other columns.
For e.g. thare are two columns "A" & "B" and now the additional column I am going to add will be sum of Values on Column "A" and "B". So how should I populate the new additiona column while exporting?
Regards<Girish
Girish,
Please try the following approach and let me know of the result:
void ultraGridExcelExporter1_ExportStarted(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.ExportStartedEventArgs e)
e.Layout.Bands[0].Columns.Insert(1, "SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSep Coll1");
e.Layout.Bands[0].Columns[1].Header.Caption = "S";
Please feel free to let me know if a question about our tool set comes up on your mind.