0

I've been trying to convert a syncfusion grid to excel but a NullReferenceException error gets popping up.

This is my code :

        GroupingGridExcelConverterControl converter = null;

        try
        {
            string filePath = DirectoryHelper.GetDirectoryPath(DirectoryHelper.TempDirectory);
            filePath = Path.Combine(filePath, "Excel" + DateTime.Now.ToString("dd-MM-yyyy HHmmss") + ".xls");

            converter = new GroupingGridExcelConverterControl();
            converter.CaptionBackColor = Color.LightBlue;
            converter.ExportStyle = false;

            converter.ExportElement += new GroupingGridExcelConverterControl.GridExportElementEventHandler(converter_ExportElement);

            converter.GroupingGridToExcel(this.grid, filePath, Syncfusion.GridExcelConverter.ConverterOptions.Default);

            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName = filePath;
            proc.Start();
            converter.ExportElement -= new GroupingGridExcelConverterControl.GridExportElementEventHandler(converter_ExportElement);

        }
        catch (Exception ex)
        {
            RootServiceProvider.ExceptionHandler.HandleException(ex);

        }
        finally
        {
            converter.ExportElement -= new GroupingGridExcelConverterControl.GridExportElementEventHandler(converter_ExportElement); ;
            converter.Dispose();
        }
  • Exception is throwing from the line :

    converter.GroupingGridToExcel(this.grid, filePath, Syncfusion.GridExcelConverter.ConverterOptions.Default);

  • I'm using VS 2010, .net 4.0 & Syncfusion 6.4.0.15

  • Stack Trace of the exception :

Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.ExportColumnHeader(GridColumnHeaderRow headerRow, IWorksheet sheet, Element element, Int32 index, ConverterOptions options, Int32 iGroupLevel, Int32& iSkipCount) at

Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.ExportElements(IList arrElements, IWorksheet sheet, Int32 index, ConverterOptions options, Int32 iGroupLevel) at Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.GroupingGridToExcel(GridGroupingControl grouping, IWorksheet sheet, ConverterOptions options) at Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.GroupingGridToExcel(GridGroupingControl grouping, String strFileName, ConverterOptions options) at Mubasher.NetPlus.Shared.Module.CommonToolBarContainer.ExportGGCToExcel()

  • Any insights on this issue?
leppie
  • 115,091
  • 17
  • 196
  • 297
Ceejee
  • 1
  • 3

1 Answers1

0

We have analyzed your reported issue at our end. We could not able to reproduce your reported scenario. We need some more details regarding your customization on ExportElements event and sample screenshot of application. So that we can try based on that.

Note: Please create a DT incident for your query for better followup.

You can create the DT incident from the following link. http://www.syncfusion.com/account/dashboard

Neelakandan K
  • 141
  • 2
  • 14