/// <summary> /// 读取excel,读出Sheet集合,设置workbook,bookItem /// 设置下拉列表选项 /// </summary> /// <param name="ins">标识</param> /// <param name="fileName">要读取的excel文件</param> private void UpdateSelect(ComboBoxIns ins, string fileName) { var bp = new EDRBookProvider(); if (!File.Exists(fileName)) { return; } var bookItem = bp.GetSimple(fileName); ComboBox select = null; switch (ins) { case ComboBoxIns.ComboBox1: //book1 = workbook; bookItem1 = bookItem; select = SelectSheet1; break; case ComboBoxIns.ComboBox2: //book2 = workbook; bookItem2 = bookItem; select = SelectSheet2; break; default: break; } this.tbBookInfo.Text += InfoProvider.GetBook(bookItem) + '\n'; select.ItemsSource = bookItem.Sheets; }
public void Get() { var bp = new EDRBookProvider(); var path1 = "./files/xlsx/class1.xlsx"; var book = bp.GetSimple(path1); Console.WriteLine(InfoProvider.GetBook(book)); }