如何通过C#获取工作表中某一列的数据 [英] How to get data of a column of a sheet by c#

查看:178
本文介绍了如何通过C#获取工作表中某一列的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个winform应用程序,该应用程序可以打开并从excel文件表中读取数据.我使用OleDbDataAdapter读取数据,然后将数据设置为数据表.但我的问题是,在此数据表中,数据的第一行用作列的名称,但是我想使用excel为每列定义的基本名称(我的意思是"ABC ... AA AB ...",

I have wrote a winform application that can open and read from a sheet of an excel file.I have used OleDbDataAdapter to read data and then set the data to a datatable. but my problem is that in this datatable the first row of data is used as the name of the columns however i want to use the base names that excel defines for each column (I mean "A B C ... AA AB ..." and so on).

推荐答案

您无法读取内置的Excel列名称,例如:A,B,C,... AA,BB,CC等. .. ZA,ZB,ZC
您需要定义它.
You can''t read builtin Excel columns names, like: A, B, C, ... AA, BB, CC, ... ZA, ZB, ZC
You need to define it.


这篇关于如何通过C#获取工作表中某一列的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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