csharp: word or excel Convert to PDF
2023-09-11 14:19:13 时间
using Word = Microsoft.Office.Interop.Word; //12.0 word 2007
using Excel = Microsoft.Office.Interop.Excel;//12.0 excel 2007
PDF转Word完全指南:3大方法满足各种场景! 还不知道PDF怎么转Word吗,本文将提供完整的PDF转Word方案,包括离线、在线或者SDK API等各种方式,总有一款满足您的需求。
geovindu 读者是,读之者,者之读.一沙一世界! to be is to do举世皆清我独浊,众人皆醒我独醉.俺是农民工,程序员.
using Word = Microsoft.Office.Interop.Word; //12.0 word 2007 using Excel = Microsoft.Office.Interop.Excel;//12.0 excel 2007
/// EXCEL文檔轉成PDF文檔 /// 參考 http://msdn.microsoft.com/en-us/library/bb256835%28v=office.12%29.aspx /// Open XML SDK 2.0 for Microsoft Office http://www.microsoft.com/en-us/download/details.aspx?id=5124 /// 塗聚文 20120907 /// /summary /// param name="infile" /param /// param name="outfile" /param public void ExportExcel2PDF(string infile, string outfile) object objOpt = Missing.Value; Excel.Application excelApp = null; excelApp = new Excel.Application(); excelApp.Workbooks.Open(infile, objOpt, objOpt, objOpt, objOpt, objOpt, true, objOpt, objOpt, true, objOpt, objOpt, objOpt, objOpt, objOpt); excelApp.ActiveWorkbook.ExportAsFixedFormat(Excel.XlFixedFormatType.xlTypePDF, (object)outfile, objOpt, objOpt, objOpt, objOpt, objOpt, objOpt, objOpt); catch (Exception ex) throw ex; finally if (excelApp != null) excelApp.Quit(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); /// summary /// WORD文檔轉成PDF文檔 /// 參考 http://msdn.microsoft.com/en-us/library/bb256835%28v=office.12%29.aspx /// /// 塗聚文 20120907 /// /summary /// param name="infile" /param /// param name="outfile" /param public void ExportWord2PDF(string infile, string outfile) object objOpt = Missing.Value; object readOnly = true; object missing=Missing.Value; object file=(object)infile; object SavePDFFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF; Word.WdExportFormat paramExportFormat = Word.WdExportFormat.wdExportFormatPDF; bool paramOpenAfterExport = false; Word.WdExportOptimizeFor paramExportOptimizeFor = Microsoft.Office.Interop.Word.WdExportOptimizeFor.wdExportOptimizeForPrint; Word.WdExportRange paramExportRange = Word.WdExportRange.wdExportAllDocument; int paramStartPage = 0; int paramEndPage = 0; Word.WdExportItem paramExportItem = Word.WdExportItem.wdExportDocumentContent; bool paramIncludeDocProps = true; bool paramKeepIRM = true; Word.WdExportCreateBookmarks paramCreateBookmarks = Word.WdExportCreateBookmarks.wdExportCreateWordBookmarks; bool paramDocStructureTags = true; bool paramBitmapMissingFonts = true; bool paramUseISO19005_1 = false; Word.Application wordApp = null; wordApp = new Word.Application(); wordApp.Documents.Open(ref file, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); wordApp.ActiveDocument.ExportAsFixedFormat(outfile, paramExportFormat, paramOpenAfterExport, paramExportOptimizeFor, paramExportRange, paramStartPage, paramEndPage, paramExportItem, paramIncludeDocProps, paramKeepIRM, paramCreateBookmarks, paramDocStructureTags, paramBitmapMissingFonts, paramUseISO19005_1, ref missing); catch (Exception ex) throw ex; finally if (wordApp != null) wordApp.Quit(ref missing, ref missing, ref missing); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); }
PDF转Word完全指南:3大方法满足各种场景! 还不知道PDF怎么转Word吗,本文将提供完整的PDF转Word方案,包括离线、在线或者SDK API等各种方式,总有一款满足您的需求。
geovindu 读者是,读之者,者之读.一沙一世界! to be is to do举世皆清我独浊,众人皆醒我独醉.俺是农民工,程序员.
相关文章
- 【原创】.NET读写Excel工具Spire.Xls使用(2)Excel文件的控制
- NPOI写Excel,Spire.XLS for.NET组件转换Excel为PDF
- Office EXCEL 中单元格怎么打斜线
- 解决poi导出Excel异常org.openxmlformats.schemas.spreadshe
- Excel日常操作
- python-win32操作excel的一些特殊功能
- POI设置EXCEL单元格格式为文本、小数、百分比、货币、日期、科学计数法和中文大写
- C#.net word excel powerpoint (ppt) 转换成 pdf 文件
- 用 ABAP 新建本地 Excel 文件并写入数据
- 【原创】.NET读写Excel工具Spire.Xls使用(4)对数据操作与控制
- Atitit 格式转换的艺术 以excel转换txt为例
- Atitit.office word excel ppt pdf 的web在线预览方案与html转换方案 attilax 总结
- Atitit.office word excel ppt pdf 的web在线预览方案与html转换方案 attilax 总结
- Winnovative Excel To PDF Converter
- 比spire.pdf速度更快:EVO PDF Print Crack
- Android修行手册 - Aspose文档格式excel/pdf/word/odt/图片等相互转换
- 成功解决将python的列表格式输出数值(如pandas.read_excel().describe())批量转到表格内
- Python和Excel的完美结合:常用操作汇总(案例详析)
- 不要逼自己学习 Excel 了,用 Python 实现 excel 的14个常用操作!
- excel根据颜色赋值 Excel填充颜色单元格替换成数字 excel把所有红色变成1
- 利用Excel批量高速发送电子邮件
- 玩转excel===Excel处理txt文件中的数据,Excel中的分列处理
- JAVA操作Excel表格:方法一:jxl的使用②:Excel实战之JXL解析读取excel文件
- 〖Python自动化办公篇⑫〗- Excel 文件自动化 - 读取 excel 数据