1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
private int getIndexFromColumn(string p)
{
// Excel application.
Microsoft.Office.Interop.Excel.Application appExcel = new Microsoft.Office.Interop.Excel.Application();
// Opening Workbook get from DialogBox.
Workbook class_act = appExcel.Workbooks.Open(Main_form.nomFichierOpen, 0, true, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
// Et on remplit l'autre ComboBox
// On récupère le nom de la première colonne dans feuil_act
Worksheet feuil_act = GetWorksheet(NomWorksheet, class_act);
int i=1;
while (feuil_act.Range[feuil_act.Cells[1, i], feuil_act.Cells[1, i]].Value2 != null)
{
if ((string)feuil_act.Range[feuil_act.Cells[1, i], feuil_act.Cells[1, i]].Value2 == p)
{
return i;
}
else
{ i++; }
}
} |
Partager