Hello,
i am trying to export a Ultra Win Grid to Excel and in the BeginExport event if ExcelExporter i have wriiten this code to add summaries:
e.Layout.Bands[0].Summaries.Add(Infragistics.Win.UltraWinGrid.SummaryType.Count, e.Layout.Bands[0].Columns[0]);
But it gives me an error which is reproduced below.
System.ArgumentNullException was caught Message="Value cannot be null.\r\nParameter name: key" Source="mscorlib" ParamName="key" StackTrace: at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value) at Infragistics.Win.UltraWinGrid.ExcelExport.FormulaExporting.MappingManager.MapWorksheetCell(SummaryInfo summaryInfo, WorksheetCell worksheetCell) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ExportSummaryCell(UltraGridExporterHelper exportHelper, SummaryValue summary, Int32 summaryLevel, IWorksheetCellFormat defaultSummaryFormatting, Rectangle summaryRect, UltraGridSummaryRow summaryRow) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ProcessSummaryRows(UltraGridExporterHelper exportHelper, UltraGridRow row, UltraGridBand band, RowsCollection rowsCollection) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ProcessGridRowInternal(UltraGridExporterHelper exportHelper, UltraGridRow row, ProcessRowParams processRowParams) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExporterHelper.ProcessRow(UltraGridRow row, ProcessRowParams processRowParams) at Infragistics.Win.UltraWinGrid.RowsCollection.InternalTraverseRowsHelper(IUltraGridExporter exporter) at Infragistics.Win.UltraWinGrid.UltraGrid.Export(IUltraGridExporter exporter) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.Export(UltraGrid grid, Worksheet worksheet, Int32 startRow, Int32 startColumn) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.Export(UltraGrid grid, WorkbookFormat workbookFormat) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.Export(UltraGrid grid, String fileName, WorkbookFormat workbookFormat) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.Export(UltraGrid grid, String fileName) at Mercury.Presentation.Common.GridSelector.btnExport_Click(Object sender, EventArgs e) in D:\Mercury New\Mercury.Presentation\Common\GridSelector.cs:line 82 InnerException:
The same code works correctly when I export the grid to PDF using DocExporter. Please help.
Are you using the latest service release? This looks like a known bug which was fixed a while ago.
How to get the latest service release - Infragistics Community
Thanks for your reply Mike.
The link that you have posted is not clickable. Can you please direct me to the link from where I can get the latest release?
Trần,
Developer Support is currently investigating your issue through case number CAS-29786-LNMTZ2. If you have additional information beyond what you've reported on this forum thread, you can update your case through the My Support Requests page of our website.
Has this bug been resolved and released ?
Since this was reported back in August, I'm sure it was fixed a long time ago.
I have downloaded and installed the latest (trial) version of NetAdvantage Windows Form (10.3.20103.1000). When I use the Excel Export with a grid with RowLayout=GroupLayout I receive a KeyNotFoundException. It seems to me it is the same bug since at 2009.1, my last installed licensed version is 9.1.20091.2094 which produces the same error.
A bad work around I am currently using is to switch of the row layout for the export. The result is not great, but no exception.
What is the state of this bug?
Hai,
I am using Infragistics 10.1. I download the sample uploaded by you and convert it to version 10. The export is working with out error.
Mike,
Thank you for your follow up. It occurs only on certain cells. In fact all other formulas calculated correctly with the exception of just one row. And, to answer the second question, the Excel export shows the correct formula and it is the actual grid that is displaying #Value.
Hi John,
Does it happen for every cell in the column? Or just some/one cell?
Is the error occurring only in the exported Excel sheet? Or is this a problem in the on-screen grid?
I'm not aware of any known bugs that would cause an issue like that. Are you certain that the result of your formula can be converted to an integer? The native type for numeric formulas is double, so I suppose it's possible that a particular large or small double value might be be convertable to an int.
Thank you for the code sample. After reviewing the sample I quickly realized that I did not place a UltraCalcManager control on the form. This solved the problem with the Excel export, however, now I have another problem relating to the formula not displaying properly in the WinGrid. All columns with the exception of one displays. The column that does not display the formula value gives an error stating "The formula results could not be converted to the column's data type". I went into the database to verify that the column was an integer and could not be null. Further more I went in and specified the column type as integer and even ensured that the DataColumn being added to the WinGrid control would not accept null values. I am at a loss as this works for other invoices that are generated. This seems to be a one off error and I am wondering if this is an Infragistics bug. The interesting things about my situation is that the export computes the formulas properly. What do you believe is going wrong here? By the way I am using 2014.1 versions of windows forms controls.
Hi,
Unfortunately, there are a million things that I can get from a sample that reproduces the problem that I cannot get from code snippets like you have here. For example, this doesn't tell me what version of the controls you are using, nor what data types the columns are. I can't see what filename you are exporting to, so I don't know what format you are using (Excel2003 or Excell2007).
If I have a small sample project that reproduces the issue, I can debug it and tell you why it's not working. With just a code snippet, all I can do is guess and try to reproduce the problem and there's no guarantee what I will ever hit on the exact right combination of circumstances to see the problem occur.
Just to rule out the things I can, I put your code into a sample with the same column names and it works fine for me both when exporting and in the Excel sheet.
I have attached my sample here so you can see if it works for you.
Thank you for your response. I have tried the formula export with and without brackets. Neither approach has worked, however for further clarification I have provided the actual formula below:
[CON20140411145558-122550A] + [CON20140415124757-122550A] + [CON20140417142125-122550A] + [CON20140520183304-122550A] + [CON20140630121220-122550A] + [CON20140703141204-122550A] + [CON20140716203705-124879A] + [CON20140723204640-131110A]
With or without the brackets it exports data, however, it will not generate a formula. Any further assistance that you can provide would be helpful. As far as a sample project is concerned I have provided the actual code that is being used in production. Is there something that I am missing here?