通过
conn.Open();
DataTable dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
连接好EXCEL后获得的表名多了。
原本就Sheet1,2,3现在得到了'sheet1$','sheet1$'_,'sheet1$'print_area,'sheet1$'print_title;'sheet2$','sheet2$'_,'sheet2$'print_area,'sheet2$'print_title。我把sheet2去了打印区域,和打印标题后就没有'sheet2$'print_area,'sheet2$'print_title了但是还有'sheet2$'_怎么整的?
如何能在读的时候就去掉这些表

解决方案 »

  1.   

    blogs.msdn.com/erikaehrli/archive/2005/08/26/hostofficeinnet.aspx
      

  2.   

    回楼上!你说的那个只是一个(类似于Delphi,DDE还是什么的记不清了)通用控件。我问的是通过OLEDB连接后获得EXCEL表名
      

  3.   

    别用OLEDB,直接用这个:http://bbs.msproject.cn/default.aspx?g=posts&t=80纯C#代码的Excel读取器(不需要Office Excel Com组件)功能:
    1. 读出在工作簿(workbook)中的所有Worksheet
    2. 读出所有WorkSheet中的单元
    3. 读取单元的内容(文本,数字,日期或错误)
    4. 读取单元的格式(字体,对齐,线条类型,背景等) 
    5. 够读取文件中的图片,获取图象的大小,位置,数据和格式
      

  4.   

    不知道我的理解有没有错误
    strin connstring="......";
    OleDbConnection con = new OleDbConnection(connstring);
    con.Open();
    DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[]{null,null,null,"Table"});
    con.Close();
    if(dt !=null)
    {
    this.listBox1.Items.Add("开始加载数据....");
    for(int i=0;i<dt.Rows.Count;i++)
    {
    //this.listView1.Items.Add(dt.Rows[i]["TABLE_NAME"].ToString());
    this.listBox1.Items.Add(dt.Rows[i]["TABLE_NAME"].ToString());
    }
    }
    else
    {
    this.listBox1.Items.Add("没有数据加载");
    }
      

  5.   

    读出了数据就是多了好多表!本来就sheet1现在出现了'sheet1$','sheet1$'_,'sheet1$'print_area,'sheet1$'print_title
    我是问怎么样筛选掉其他表