[UWP] OleDbConnection的替代方案,用于读取Excel文件并将其导入UWP上的DataGridView [英] [UWP]Alternatives for OleDbConnection for reading Excel files and importing them to DataGridView on UWP
问题描述
大家好。
当您想要将数据从Excel文件导入DataGridView时,您是否知道OleDb的替代品?当我为WinForms创建程序时,我只使用OleDb来读取excel文件并将其传输到DataGridView。现在我正在创建一个
的UWP应用程序,而且UWP不存在OleDb,我需要在不使用第三方扩展的情况下阅读Excel文件。任何想法都会有很大帮助。谢谢
Do you have any idea for alternatives for OleDb when you want to import data from an Excel file to a DataGridView. When I was creating Programs for WinForms i just use OleDb to read the excel file and transfer it to the DataGridView. Now I am creating a UWP app and OleDb doesn't exist for UWP anymore, and I need to read Excel files without using third party extensions. Any ideas would greatly help. Thank you
推荐答案
首先,没有可用于从Excel文件导入数据的内置库。但还有其他方法可以做到这一点。一种方法是您可以使用 Open XML SDK 。使用.NET
Standard 2.0,现在UWP应用程序可以在UWP应用程序中使用Open XML SDK。这可以用于从Excel文档中提取数据。
First of all, there is not build-in libraries that could be used for import data from an Excel file. But there are other ways to do that. One way is that you could use Open XML SDK. With the .NET Standard 2.0, now UWP apps could use Open XML SDK in UWP apps. And this could be used to extract of data from Excel documents.
另一种方法是您可能需要自己实现此功能。这是一个你可以参考的主题:在WinRT平台上使用C#读取
Excel文件。
Another way is that you might need to implement this function yourself. Here is a thread that you could refer about:Reading Excel file using C# in WinRT platform.
祝你好运,
Roy
这篇关于[UWP] OleDbConnection的替代方案,用于读取Excel文件并将其导入UWP上的DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!