在Datagrid视图中导入Excel工作表 [英] Import Excel sheet in Datagrid view

查看:79
本文介绍了在Datagrid视图中导入Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







请帮帮我

我想在数据网格中导入Excel工作表数据在vb.net。

Hi ,


Please help me
I want to import excel sheet data in data grid in vb.net.

推荐答案

首先,您需要导入处理Excel文件所需的库。这样做不仅可以导入Excel文件,还可以编辑和保存(创建)它们。



使用:

First you need to import the library which is required to handle Excel files. Doing so will allow you not only to import Excel files, but to edit and save (create) them.

Use:
Imports Excel = Microsoft.Office.Interop.Excel 



在您的开头程序。



为了访问Excel文件,您需要设置3个元素:



Excel.Application - 用于整个Excel接口

Excel.Workbook - 应指向实际的Excel文件(.xls或.xlsx)

Excel.Worksheet - 应指向要从中导入的工作表。


at the beginning of your program.

There are 3 elements you need to set to something, in order to access the Excel file:

Excel.Application - for the entire Excel interfacing
Excel.Workbook - should point to the actual Excel file (.xls or .xlsx)
Excel.Worksheet - should point to the worksheet you with to import from.


另一种实现方法是使用 OleDb类 [ ^ ]对象。



有看他一眼re:

http://vb.net-informations.com/datagridview/ vb.net_datagridview_import.htm [ ^ ]

http:/ /blueraiden.exofire.net/blog/import-excel-spreadsheet-data-to-datagridview-using-vb-net [ ^ ]
Another way to achieve that is to read Excel files using OleDb Class[^] objects.

Have a look here:
http://vb.net-informations.com/datagridview/vb.net_datagridview_import.htm[^]
http://blueraiden.exofire.net/blog/import-excel-spreadsheet-data-to-datagridview-using-vb-net[^]


这篇关于在Datagrid视图中导入Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆