关于将办公室转换为PDF

我使用“Microsoft.Office.Interop.Excel”将Excel转换为PDF,但是当我的源文件大小比如10MB大时,需要很长时间…

public static bool XLSConvertToPDF(string sourcePath, string targetPath) { bool result = false; XlFixedFormatType targetType = XlFixedFormatType.xlTypePDF; object missing = Type.Missing; Microsoft.Office.Interop.Excel.ApplicationClass application = null; Workbook workBook = null; try { application = new Microsoft.Office.Interop.Excel.ApplicationClass(); object target = targetPath; object type = targetType; workBook = application.Workbooks.Open(sourcePath, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing); workBook.ExportAsFixedFormat(targetType, target, XlFixedFormatQuality.xlQualityStandard, true, false, missing, missing, missing, missing); result = true; } catch { result = false; } finally { if (workBook != null) { workBook.Close(false, missing, missing); workBook = null; } if (application != null) { application.Quit(); application = null; } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); } return result; } 

1.是否有好的build议或替代组件可供使用?

2.我知道有Adobe API,但效率如何?

顺便说一下,我也想将docx或pptx转换为pdf。 非常感谢!!