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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

120855 Oct 22,2015 09:28 AM Oct 27,2015 07:52 AM WPF 5
loading
Tags: SfSpreadsheet
KARTHICK
Asked On October 22, 2015 09:28 AM

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 06:16 AM

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.


Regards,
Kanimozhi B


KARTHICK
Replied On October 23, 2015 06:54 AM

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


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

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",

                                                    ExcelOpenType.Automatic);

IWorksheet sheet = workbook.Worksheets[0];

IListObject table = sheet.ListObjects[0];

Please let us know if you have any query.

Regards,

Kanimozhi B


KARTHICK
Replied On October 26, 2015 04:02 AM

Hi.,
       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 07:52 AM

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.

Regards
Kanimozhi B

CONFIRMATION

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.

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.

;