Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1825
Application Crashes after Reordering Columns and Exporting to Excel
posted

I am using InfragisticsWPF3.DataPresenter.ExcelExporter.v10.2 and we have a  XamDataGrid with the Export to Excel feature. After I sort a particular column and then Export to Excel the application Crashes with the exception

 

"Field named  was not found in data source: Record\r\nParameter name: FieldName"

 

I have the following code for the Export to Excel

 

private void ExecutedXLExportGridCommand(object sender_, ExecutedRoutedEventArgs e_)

    {

      if (!(e_.Parameter is string))

        return;

 

      switch (e_.Parameter as string)

      {

        case "MainGrid":

          ExportGrid(ux_gridStudyContent);

          break;

      }

    }

 

    private static void ExportGrid(DataPresenterBase grid_)

    {

      string _temporaryFile = string.Format("{0}\\{1}_PnLLink_Export.xls",

                                            Environment.GetFolderPath(Environment.SpecialFolder.InternetCache),

                                            Guid.NewGuid().ToString("N"));

 

      var _exporter = new DataPresenterExcelExporter();

      _exporter.Export(grid_, _temporaryFile, WorkbookFormat.Excel97To2003);

      Process.Start(_temporaryFile);

    }

 

The Export to Excel works fine when I do not sort any column

  • 2677
    posted

    Hello,

    Do you perhaps have a sample application that demonstrates this bug.  I tried my own sample and exported the grid and can't seem to reproduce the problem.  I have just a plain grid bound to a datasource which is a datatable for brevity.  Please either send a sample or exact specifications on the datasource type, if you are manually generating FieldLayouts etc.  Your xaml source would be great because then I could see all the properties that you are setting. 

    Once I have more information on the issue and am able to see it occur, I will be able to fix it or send it off to development for a closer look.  Thanks and hope to talk to you soon.