获取Excel的sheet名称和数量
2009-05-12 16:18
309 查看
string name=sheet.Name; //获取该sheet的名称
string amount=book.WorkSheets.Count.ToString(); //获取该book的sheet数量。
string sSheetName=null;
object missing = Missing.Value;
OleDbConnection conn = new OleDbConnection();
Excel.Application excelApp = new Excel.Application();
excelApp.Application.Workbooks.Open(path, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,Missing.Value ,Missing.Value,Missing.Value,Missing.Value ,Missing.Value ,Missing.Value );
for (int i = 0; i < excelApp.Workbooks[1].Worksheets.Count; i++)
{
Excel.Worksheet ws = (Excel.Worksheet)excelApp.Workbooks[1].Worksheets[1];
sSheetName = ws.Name;
}
string amount=book.WorkSheets.Count.ToString(); //获取该book的sheet数量。
string sSheetName=null;
object missing = Missing.Value;
OleDbConnection conn = new OleDbConnection();
Excel.Application excelApp = new Excel.Application();
excelApp.Application.Workbooks.Open(path, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,Missing.Value ,Missing.Value,Missing.Value,Missing.Value ,Missing.Value ,Missing.Value );
for (int i = 0; i < excelApp.Workbooks[1].Worksheets.Count; i++)
{
Excel.Worksheet ws = (Excel.Worksheet)excelApp.Workbooks[1].Worksheets[1];
sSheetName = ws.Name;
}
相关文章推荐
- C#获取Excel中所有的Sheet名称
- C#获取Excel中所有的Sheet名称
- 用 SQL 脚本读取Excel 中的sheet数量及名称
- Excel导入时,如何获取第一个Sheet名称
- 用SQL脚本读取Excel中的sheet数量及名称的方法代码
- VB.Net获取Excel中Sheet的名称
- 用SQL脚本读取Excel中的sheet数量及名称的方法代码
- 在SQL Server中获取Excel文件中所有Sheet工作表的名称
- C#获取Excel中所有的Sheet名称
- c#获取excel中的所以sheet名称
- C#获取Excel中所有的Sheet名称
- excel获取所有的sheet文件名称
- 用 SQL 脚本读取Excel 中的sheet数量及名称
- python 获取excel文件内sheet名称列表
- 获取Excel中的Sheet的名称
- excel合并多个sheet,sheet名称模糊匹配,并从第二行开始
- .Net 获取 Excel 的各个Sheet 名字
- WinForm开发中,将Excel文件导入到DataGridView中时,获取Excel中所有表格的名称。
- 解析SQLServer获取Excel中所有Sheet的方法
- OpenXml 获取Excel文件指定工作簿中的表格部件和表格数量