开发者

how to provide list of sheets of file in combo box?

开发者 https://www.devze.com 2022-12-28 14:15 出处:网络
I have to load excel file into sql server i use window application so i select filepath in textbox when click button using fileopendialogbox my problem is that i want ot provide list of开发者_如何学运

I have to load excel file into sql server i use window application so i select filepath in textbox when click button using fileopendialogbox my problem is that i want ot provide list of开发者_如何学运维 sheets of file in combo box.

so user can select appropriate sheet to upload. Because it may possible that there are many sheets in file and tool doesn’t know which one to upload.


Something like:

  this.openFileDialog1.FileName = "*.xls";
  if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
   {
      Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open(
         openFileDialog1.FileName, 0, true, 5,
          "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false,
          0, true); 
     Excel.Sheets sheets = theWorkbook.Worksheets;
     list.Add (sheets);
   }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号