打印excel文件c#

我已经在c#中做了一个程序为了打印一个excel文件,他打印的很好,而且所有的网格。 但我不想看到网格。

我已经这样做了:

System.Windows.Forms.MessageBox.Show("Ok !", "Impression", MessageBoxButtons.OK); //PrintDocument document = new PrintDocument(); //document.DocumentName = file; //document.Print(); // On déclare l'application Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application(); // On ouvre un classeur XLS : Microsoft.Office.Interop.Excel.Workbook wb = app.Workbooks.Open(chemin.Text, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); // On ouvre la première feuille : // la numérotation commence à 1 et pas à 0 ici Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets[1]; // Utiliser la Mise en page avec PageSetup // Les entêtes de ligne et de colonne sont à répéter sur toutes les pages : //ws.PageSetup.PrintTitleColumns = "$A:$B"; //ws.PageSetup.PrintTitleRows = "$1:$2"; ws.PageSetup.PrintHeadings = false; ws.PageSetup.BlackAndWhite = false; ws.PageSetup.PrintGridlines = true; // Lancement de l'impression par défaut ws.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); // Afficher l'application Excel app.Visible = false; // Fermer l'application Excel wb.Save(); wb.Close(false, Type.Missing, Type.Missing); app.Quit(); // Réinitialise l'application chemin.Text = "Imprimé !"; 

不注意评论,我是法国人。

尝试设置

 ws.PageSetup.PrintGridlines = false; 

代替

 ws.PageSetup.PrintGridlines = true;