+ 3

Copy and Paste from Excel to WPF DataGrid

I'm trying to implement a copy and paste functionality in WPF app. i.e from MS Excel to DataGrid. I saw some sample codes online like these ones below but non of them met my requirement https://www.codeproject.com/Articles/246306/Implementing-Copy-Paste-for-WPF-DataGrid-net-4 https://stackoverflow.com/questions/4118617/wpf-datagrid-pasting What I want is; when pasting, the data on the DataGrid should appear as what it was in the MS Excel. (Assuming you're copying from one excel sheet to another). Thanks!

23rd Jan 2019, 6:35 PM
John Ansa
John Ansa - avatar
2 ответов
0
Thanks Adam for your answer
15th Apr 2019, 7:10 AM
John Ansa
John Ansa - avatar
- 1
You should use open office xml package to read the Excel file. Then just read the headers to create the datagridview columns and fill in the data.
18th Feb 2019, 3:30 AM
Adam Schmitt
Adam Schmitt - avatar