且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我如何将Excel工作表数据导入网格

更新时间:2023-01-21 13:20:13

Hello Guna1431



此问题已在另一个论坛中提出并回答。请看这个链接:



如何在c#中从excel表到datagridview获取数据[ ^ ]



您也可以从使用NPOI中受益:

http://npoi.codeplex.com/ [ ^ ]



我在这个问题论坛上找到了一些参考:

http://***.com/questions/657131/how-to-read-data-of-an-excel-file-using-c# [ ^ ] uote>

//Connection String to Excel Workbook

if (strFileType.Trim() == ".xls")

{

connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";

}else if (strFileType.Trim() == ".xlsx")

{

connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";

}

in this please expalin the string

 "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";

and when i want to use otherthan MS Office like Kingsoft or open office what should i do...

Thanks in advance  :)


Hello Guna1431

This question has been asked and answer in another forum. Please have a look on this link:

How to get data from excel sheet to datagridview in c#[^]

You may also benefit from using NPOI:
http://npoi.codeplex.com/[^]

And I've found some reference to this question forum:
http://***.com/questions/657131/how-to-read-data-of-an-excel-file-using-c#[^]