How to get specific Range in Excel through COM Interop?

前端 未结 1 1313
悲&欢浪女
悲&欢浪女 2020-12-31 23:32

I have to read an excel file through a COM interop. I search for a specific string using this:

this.sheet = (Excel.Worksheet)this.excelApp.Workbook.Sheets.Ite         


        
相关标签:
1条回答
  • 2021-01-01 00:03

    Okay, after some sleep i have found the answer.

     int startColumn = Header.Cells.Column;
     int startRow = header.Cells.Row + 1;
     Excel.Range startCell = this.sheet.Cells[startRow, startColumn];
     int endColumn = startColumn + 1;
     int endRow = 65536;
     Excel.Range endCell = this.sheet.Cells[endRow, endColumn];
     Excel.Range myRange = this.sheet.Range[startCell, endCell];
    
    0 讨论(0)
提交回复
热议问题