导入的Excel文件到datagridview的问题 [英] problem with imported excel file to datagridview
问题描述
你好,
我没有完全将excel文件导入到dgv有一点问题,但是excel单元格中的点在导入到dgv时变为#< br $> b $ b
我不想改变,我不知道为什么会发生这种情况????
excel工作表DIR中有一个单元格(在众多单元格中)。 for it
当我导入excel到dgv时转向这个DIR#FOR IT
WHYYYYYYYYYY
我不想让它改变
我的表格看起来像这样
Hello,
I have a little problem with not exactly importing excel file to dgv, but with dots from excel cell which when imported to dgv changes to #
and I don' want that to change, I don't know why is that happening????
I have a cell (among many) in excel worksheet DIR. FOR IT
and when I import excel to dgv that turns to this DIR# FOR IT
WHYYYYYYYYY
I dont want it to change
my sheet looks like this
ID DIR. FOR IT
test
test1
test2
test3
我的导入代码是
my code for import is
string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 8.0;HDR=YES;IMEX=1;""", importfileCN);
string query = String.Format("select * from [{0}]", cmbExcelSheet1.Text);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connectionString);
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
dgCN.DataSource = dataSet.Tables[0];
dgCN是datagridview,一切正常,但我得到的名字像我说的那样,DIR#FOR IT
dgCN is datagridview and everything works, but I get the name of the column like I said, DIR# FOR IT
推荐答案
我希望这个链接可以帮助你。
从C#中从GridView导出到Excel [ [^ ]
i hope this link some help you.
Export to Excel from GridView in C#[^]
这篇关于导入的Excel文件到datagridview的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!