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 26
|
using Excel = Microsoft.Office.Interop.Excel;
public static void ValoriserExcel(string NomFichier)
{
object filename = NomFichier;
// lance excel
Excel.Application msExcel = new Excel.Application();
//true pour afficher excel false pour le lancer en tache de fond
msExcel.Application.Visible = true;
object missing = System.Reflection.Missing.Value;
Excel.Workbook nvClasseur;
//on ouvre le fichier
nvClasseur = msExcel.Workbooks.Open(filename.ToString(), missing, missing, missing, missing, missing, missing, missing, missing , missing, missing, missing, missing, missing, missing);
//On ferme le fichier
nvClasseur.Close(// passe ici tes paramètre pour sauvegarder ton fichier)
//On ferme l'application
msExcel.Quit();
} |
Partager