Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1.   private void ExporterÉchantillon(string nomFichierExtrant, string[,] unÉchantillon)
  2.         {
  3.             var xlApp = new Excel.Application();
  4.             var xlWorkBook = xlApp.Workbooks.Add();
  5.             var xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.Item[1];
  6.             xlWorkSheet.Name = "Échantillon";
  7.  
  8.             for (int ligne = 0; ligne < unÉchantillon.GetLength(0); ligne++)
  9.             {
  10.                 for (int colonne = 0; colonne < unÉchantillon.GetLength(1); colonne++)
  11.                 {
  12.                     xlWorkSheet.Cells[ligne + 1, colonne + 1] = unÉchantillon[ligne, colonne];
  13.                 }
  14.             }
  15.  
  16.             // Si la case d'ajouter la population est activée, on ajoute la population !
  17.             AjouterPopulationSiNécéssaire(xlWorkBook);
  18.  
  19.             xlWorkBook.SaveAs(nomFichierExtrant);
  20.             xlWorkBook.Close(true);
  21.             xlApp.Quit();
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement