❔ How to import Excel File with row header to GridControl using C#. WPF application
Hello, can someone please help me write the code? I added a button that can browse and get path for excel file. The name of gridcontrol is Grids. And assume the code is written in button class
24 Replies
what is GridControl?
It’s a tool from DevExpress
then it looks like you'll want to use DevExpress' built-in support for Excel files?
ExcelItemsSource?
Bind to Excel Data Sources | WPF Controls | DevExpress Documentation
Developer documentation for all DevExpress products.
Isn’t there a way to loop over excel file,add it to data table then bind it with GridControl?
sure, that sounds horrifying though, if DevExpress already does that whole thing for you
you'd need to pull in an Excel parsing engine, like IronXL or OpenXML
Thing is idk what exactly the recruiter wants from me
Like he told me here is an excel file import it to GridControl
then you probably want to go with the not-horrifying option
Idk if I should build the desktop over this specific file( in this case link you sent) or over any excel file( in this case we loop over it)
what does looping have to do with anything?
I mean go over excel file and add it to data table
And then bind datatable to grid control
I.E. parse the file yourself
don't do that if DevExpress can do it for you, that's silly
But according to link you sent it was manually specified the column headers
and I doubt he's expecting you tk hard-code the file either
not true
yes, and?
He specified the columns of this specific excel file
and that's a requirement?
that supercedes the snippet directly above that where an ExcelItemsSource is declared without any columns defined?
I didn’t get what you said
regardless
If you've been instructed to use DevExpress, it seems like you should stick to that as much as possible
I really have no idea how that works, specifically, the documentation is hilariously sparse, from what I can see. You either need to find more documentation, perhaps what came with your license, or start screwing around in code to see how it behaves.
Alright thank you
outside of DevExpress, it's what you say. You would parse all the rows out of the excel file yourself, and bind them into the GridControl, and for that you'll need a parsing library like IronXL or OpenXML
Kindly find attached the excel containing the data it should be imported into the database.
We need a form to import this template to a DevExpress Grid Control and then save it to the database.
You need the following tools to be installed on your PC:
Visual studio
SQL server DevExpress Kindly note that you should create a WPF application using C#. this is the email that was sent
SQL server DevExpress Kindly note that you should create a WPF application using C#. this is the email that was sent
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.