一、获取所有sheet

 

 try
            {
                string strFileName = "d:\\Book1.xls";
                string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +  "Data Source=" + strFileName + ";" +   "Extended Properties=Excel 8.0;";
                OleDbConnection conn = new OleDbConnection(strConn);
                conn.Open();
                DataTable schemaTable = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
                foreach (DataRow row in schemaTable.Rows)
                {
                    for (int i = 0; i < schemaTable.Columns.Count; i++)   {
                        Response.Write(row[i].ToString() + "    ");
                    }
                    Response.Write("<br/>");
                }
                conn.Close();
            }
            catch (Exception ex)
            { 
            }



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
猜你喜欢
  • 2021-07-13
  • 2021-11-03
  • 2022-12-23
  • 2021-09-05
  • 2021-09-27
  • 2021-05-30
  • 2022-12-23
相关资源
相似解决方案