7
我有以下問題。我必須通過COM互操作來讀取一個excel文件。我是使用COM interop編程的新手。如何通過COM Interop在Excel中獲取特定範圍?
我搜索使用這個特定的字符串:
this.sheet = (Excel.Worksheet)this.excelApp.Workbook.Sheets.Item[this.sheetname];
this.sheet.Activate();
Excel.Range firstRow = this.sheet.Range["A1", "XFD1"];
Excel.Range foundRange = firstRow.Find(
this.StringISearch,
Type.Missing,
Type.Missing,
Excel.XlLookAt.xlWhole,
Excel.XlSearchOrder.xlByColumns,
Excel.XlSearchDirection.xlNext,
false,
false,
Type.Missing);
不,我想用foundRange爲出發點,以得到另一個範圍。
像這樣的事情
Excel.Range MyRange = this.sheet.Range[foundRange + 2 rows, + 1 column & lastRow];
我不明白的方式來做到這一點。有一個嗎?