如何使用LinqToExcel获取Excel文件的图纸名称? [英] How do I use LinqToExcel to get the sheet names of an Excel file?

查看:84
本文介绍了如何使用LinqToExcel获取Excel文件的图纸名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用LinqToExcel.我希望能够获取Excel文件中所有工作表的名称,并将它们与我的html表单中的输入值进行比较,以便当输入值与Excel工作表中的任何名称都不匹配时,系统会引发异常.我该如何使用LinqToExcel做到这一点?

I am using LinqToExcel. I want to be able to get the names of all sheets in an Excel file and compare them with an input value from my html form such that when the input value does not match any of the names on the Excel sheet, the system throws an exception. How do I go about using LinqToExcel to do this?

推荐答案

文档说:

GetWorksheetNames()方法可用于检索电子表格中的工作表名称列表.

var excel = new ExcelQueryFactory("excelFileName");
var worksheetNames = excel.GetWorksheetNames();

这篇关于如何使用LinqToExcel获取Excel文件的图纸名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆