zoukankan      html  css  js  c++  java
  • C#找到Excel中的所有Sheetname的方法

    #region 找到Excel的所有Sheetname
            /// <summary>
            /// 找到Excel的所有Sheetnames
            /// </summary>
            /// <returns>返回Sheetnames</returns>
            private List<string> ExcelSheetName()
            {
                string conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txt_Filepath.Text + ";Extended Properties=Excel 8.0;";
                List<string> sheetNames = new List<string>();
                using (OleDbConnection con = new OleDbConnection(conString))
                {
                    con.Open();
                    System.Data.DataTable sheetName = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "table" });
                    con.Close();
                    foreach (DataRow var in sheetName.Rows)
                    {
                        sheetNames.Add(var[2].ToString());
                    }
                }
                return sheetNames;
            }
            #endregion

  • 相关阅读:
    invalid expression: missing ) after argument list in xxx 或者 console.error(("[Vue warn]: " + msg + trace));
    js的alert()
    第9节列表渲染
    第8节条件渲染
    第7节class与style绑定
    CF1215D Ticket Game 博弈论
    CF833A The Meaningless Game 思维
    蚯蚓 队列
    洛谷P2566[SCOI2009]围豆豆
    ants 思维
  • 原文地址:https://www.cnblogs.com/jasonjiang/p/1787819.html
Copyright © 2011-2022 走看看