Tag: linq to excel

如何使用LinqToExcel获取excel文件的工作表名称

我正在使用LinqToExcel,我希望能够获取excel文件中所有工作表的名称,并将其与我的html表单中的输入进行比较,以便当输入与excel表上的任何名称都不匹配时,系统将抛出exception。 我如何使用LinqToExcel来做到这一点

在内存中阅读Excel电子表格

如何阅读刚刚发布到我的服务器的Excel电子表格? 我搜索了一些东西,但我只找到了如何阅读带有文件名路径的Excel电子表格,这不是我的情况。 我需要这样的东西: public ActionResult Import(HttpPostedFileBase file) { var excel = new ExcelQueryFactory(file); //using linq to excel }

LinqToExcel加载字典

我有以下解决方案但不太优雅。 如果可能的话,我想用ToDictionary来解决这个问题。 谢谢你的帮助,因为我很新。 var excel = new ExcelQueryFactory(@”E:\MAHipotCepaStationProgram.xlsx”); //get list of program names List testNames = new List(); testNames.AddRange(excel.Worksheet().ToList() .Where(s => s[“Program #”].Value.ToString() == “Program Title”) .Select(s => s[1].Value.ToString())); //get list of program numbers List testNumbers = new List(); testNumbers.AddRange(excel.Worksheet().ToList() .Where(s => s[“Program #”].Value.ToString() == “Program #”) .Select(s => Convert.ToInt32(s[1].Value))); //combine them Dictionary programs = […]