开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜