简体   繁体   English

在C#中读取具有多个工作表的Excel的Excel工作表名称

[英]To read excel sheetname for Excel having multiple sheet in C#

when i upload excel file, I want to validate my sheet from Excel by checking its sheet name. 当我上传excel文件时,我想通过检查工作表名称来从Excel验证我的工作表。 And compare it with string Since my Excel File Contains * sheets and i need to check all Sheet name if they match with standard Format. 并将其与字符串进行比较,因为我的Excel文件包含*工作表,如果它们与标准格式匹配,我需要检查所有工作表名称。

If your server deployment contains microsoft office you can make use of microsoft.office.interop library reference and use within your code. 如果您的服务器部署包含microsoft office,则可以使用microsoft.office.interop库参考,并在您的代码中使用。 This will help you to read the file programmatically. 这将帮助您以编程方式读取文件。

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.aspx http://msdn.microsoft.com/zh-CN/library/microsoft.office.interop.excel.aspx

http://www.microsoft.com/en-us/download/details.aspx?id=3508 http://www.microsoft.com/zh-cn/download/details.aspx?id=3508

Otherwise you can also use free libraries like the below to get your job done: https://code.google.com/p/excellibrary/ 否则,您还可以使用如下所示的免费库来完成工作: https : //code.google.com/p/excellibrary/

Ultimately you need to fetch the worksheet array, loop through that and match worksheet name(s) with the required format. 最终,您需要获取工作表数组,循环遍历并以所需格式匹配工作表名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM