We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridDataControlExportExtensions.ExportToExcel with Columnstyle CurrencyEdit

Hello

I have a problem when I try to export my grid to Excel. I have narrowed the problem down to Columnstyle CurrencyEdit, when I remove the Columnstyle everything works. Is there anyway to keep the style and still export or what can I do?

XAML:
                <syncfusion:GridDataVisibleColumn MappingName="TotalFees"
                                                  HeaderText="{Binding Source={x:Static prop:Resources.frmEconomicScedularStatistic_TotalFees}}"
                                                  Width="80" >
                    <syncfusion:GridDataVisibleColumn.ColumnStyle>
                        <syncfusion:GridDataColumnStyle
                                                        HorizontalAlignment="Right" CellTypeEnum="CurrencyEdit">
                        </syncfusion:GridDataColumnStyle>
                    </syncfusion:GridDataVisibleColumn.ColumnStyle>
                </syncfusion:GridDataVisibleColumn>


EXCEL:
            try
            {
                if (gridData.ItemsSource != null)
                {
                  
                    Syncfusion.Windows.Controls.Grid.Converter.GridDataControlExportExtensions.ExportToExcel(this.gridData, @"result.xls", Syncfusion.XlsIO.ExcelVersion.Excel97to2003);
                    System.Diagnostics.Process.Start(@"result.xls");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }

ERROR:
System.NullReferenceException occurred
  HResult=-2147467261
  Message=Objektreferensen har inte angetts till en instans av ett objekt.
  Source=Syncfusion.GridConverter.Wpf
  StackTrace:
       vid Syncfusion.Windows.Controls.Grid.Converter.GridExcelConverterControl.GridCellToExcel(GridModel gridModel, Int32 row, Int32 column, IRange range)
       vid Syncfusion.Windows.Controls.Grid.Converter.GridDataControlExportExtensions.ExportToExcel(GridDataControl gridDataControl, GridRangeInfo gridRange, IWorksheet workSheet, IRange excelRange)
       vid Syncfusion.Windows.Controls.Grid.Converter.GridDataControlExportExtensions.ExportToExcel(GridDataControl gridDataControl, String fileName, ExcelVersion excelVersion)
       vid Opus.UI.Wpf.Windows.frmEconomicScedularStatistic.cmdExcel_Click(Object sender, RoutedEventArgs e) i c:\WS\Dev\Opus.UI.Wpf\Windows\frmEconomicScedularStatistic.xaml.cs:rad 568
  InnerException:

1 Reply

RG Rajasekar G Syncfusion Team November 25, 2012 06:26 PM UTC

Hi Marcus,

 

Sorry for the inconvenience caused. We have tested the reported issue in different scenario but we are unable to reproduce the issue. Could you please check the below sample?

 

Sample: GridDataControlSample.zip

 

We suspect you are using our grid in some other scenario, So If possible could you please modify our sample and revert us with replication procedure, that would be very helpful to resolve your problem earlier.

 

Please let know if you have any queries.

 

Thanks,

Rajasekar

 


Loader.
Live Chat Icon For mobile
Up arrow icon