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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Read the Excel/ Open office Document Spread sheet file value in WPF Application.

Thread ID:





120855 Oct 22,2015 01:28 PM UTC Oct 27,2015 11:52 AM UTC WPF 5
Tags: SfSpreadsheet
Asked On October 22, 2015 01:28 PM UTC

1. Create a MainWindow.xaml.This Window only used on data grid.The Column or Header values are created in dynamically.
2.create a excel file for openoffice /Microsoft office.
3.Excel file values are read to the datagrid in wpf application.

Kanimozhi Bharathi [Syncfusion]
Replied On October 23, 2015 10:16 AM UTC

Hi Karthick,

Thank you for contacting Syncfusion Support.

Currently our SfDatagrid control does not have support to import excel files. However if you want to import excel files into grid, then we recommend you to use our SfSpreadsheet control and this control allows you to create, edit and view the Excel files.


You can also dynamically set the header values in QueryRange Event of SpreadsheetGrid like the following snippet,


spreadsheet.WorkbookLoaded += spreadsheet_WorkbookLoaded;
void spreadsheet_WorkbookLoaded(object sender, WorkbookLoadedEventArgs args)
    foreach (var grid in args.GridCollection)
        grid.QueryRange += grid_QueryRange;
void grid_QueryRange(object sender, SpreadsheetQueryRangeEventArgs e)
    if (e.Cell.RowIndex == 0 && e.Cell.ColumnIndex > 0)         
        e.CellValue = "Header" + e.Cell.ColumnIndex;
    e.Handled = true;


Please find the attached UG document for your reference,

UG: http://www.syncfusion.com/downloads/support/forum/120855/pd/Spreadsheet_(1)464250273

Also please find the dashboard samples in the following link,


Link: Syncfusion Dashboard->WPF->Run Local Samples->Grids->Spreadsheet

Please let us know if you have any other requirements.

Kanimozhi B

Replied On October 23, 2015 10:54 AM UTC

Sorry I am not using syncfusion toolkit. i am using Visual studio 2010.

Kanimozhi Bharathi [Syncfusion]
Replied On October 25, 2015 04:38 PM UTC

Hi Karthick,

Please find the below SfSpreadsheet sample for your reference,

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/CS1913886146

You can also import excel files to SfDataGrid by converting worksheet to DataTable like the below snippet,

IWorkbook workbook = application.Workbooks.Open("Sample.xlsx",


IWorksheet sheet = workbook.Worksheets[0];

IListObject table = sheet.ListObjects[0];

Please let us know if you have any query.


Kanimozhi B

Replied On October 26, 2015 08:02 AM UTC

       Thanks for thanks. I have developed on the application in wpf.Without using the syncfusion application

Attachment: XlsxReadWrite_4c51b00b.rar

Kanimozhi Bharathi [Syncfusion]
Replied On October 27, 2015 11:52 AM UTC

Hi Karthick,

Syncfusion provides SfSpreadsheet control which allows you to create, edit and import the Excel files. If this is not your requirement, could you please share us more details regarding your requirement clearly, So that we will update you with better response.

Kanimozhi B


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon