public static void Print(PrintType printType, BarcodeSample sample, TestResult technic, TestResult reality) { ExcelAccess access = new ExcelAccess(); string path = ConfigurationManager.AppSettings["template"]; string fullPath = Path.GetFullPath(path); access.Open(fullPath); access.IsVisibledExcel = true; access.FormCaption = "商品条码符号检测数据"; switch (printType) { case PrintType.Print: access.Print(); break; case PrintType.PrintView: access.PrintPreview(); break; default: access.Close(); break; } access.Close(); }