1 2 3 4 5 6 7 8 9 10
| String FilePath = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath,
AppDomain.CurrentDomain.BaseDirectory + @"xls/File.xls");
Microsoft.Office.Interop.Excel.Application exl = new Microsoft.Office.Interop.Excel.Application();
exl.Visible = true;
Microsoft.Office.Interop.Excel.Worksheet w = new Microsoft.Office.Interop.Excel.Worksheet();
w = (Microsoft.Office.Interop.Excel.Worksheet)exl.Workbooks.Open(FilePath, 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).Worksheets.get_Item(1);
w.PrintOutEx(1, 1, 1, true, Type.Missing, false, true, Type.Missing, true);
exl.Workbooks.Close();
exl.Quit(); |
Partager