public CommonResult PrintFile(string filePath, string printType) { if (!File.Exists(filePath)) { return(JResult.Error("文件不存在")); } ExcelApp excel = new ExcelApp(); excel.Open(filePath); if (printType == PrintType.Preview.GetHashCode().ToString()) { excel.IsExcelAppVisibled = true; excel.PrintPreview(); } else { var app = excel.Application; app.WindowState = XlWindowState.xlNormal; app.Width = app.Height = 0; var dialogResult = app.Dialogs[XlBuiltInDialog.xlDialogPrint].Show(); app.Quit(); } Utils.DeleteExcel(); excel.Close(); //File.Delete(filePath); return(JResult.Success()); }
public CommonResult GetVersion() { var version = Utils.GetAssemblyInfo(); return(JResult.Success("获取成功", "0", version)); }