在excelWorkbook.ExportAsFixedFormat行中,excel转换为pdf。伴随着转换进度弹出窗口。如何向用户隐藏此过程?
public void ConvertExcelToPdf(string fileName)
{
Excel.Application excelApplication = new Excel.ApplicationClass();
excelApplication.ScreenUpdating = false;
excelApplication.DisplayAlerts = false;
excelApplication.Visible = false;
Excel.Workbook excelWorkbook = excelApplication.Workbooks.Open(fileName + ".xlsx", null, true);
if (excelWorkbook == null)
excelApplication.Quit();
excelWorkbook.ExportAsFixedFormat(Excel.XlFixedFormatType.xlTypePDF, fileName + ".pdf");
excelWorkbook.Close(false);
excelApplication.Quit();
}