Comment obtenir une Gamme spécifique dans Excel via COM Interop?

j'ai le problème suivant. Je dois lire un fichier excel via COM interop. Je suis nouveau à la programmation avec COM interop.

Je recherche une chaîne de caractères en utilisant ceci:

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);

Pas je veux utiliser le foundRange comme un point de départ pour une autre gamme.

Quelque chose comme cela

Excel.Range MyRange = this.sheet.Range[foundRange + 2 rows, + 1 column & lastRow];

Je ne vois pas le moyen de le faire. Est-il un?

OriginalL'auteur mrt181 | 2010-11-30