当前位置: 首页 > news >正文

网贷网站建设wordpress购物插件下载

网贷网站建设,wordpress购物插件下载,建设网站注意实现,如果建立网站前面两篇博客讲解了怎么通过程序控制word的生成#xff0c;包括生成文字、添加表格、添加图片等。这篇博客主要说一下怎么把word图片转换成pdf。 using System; using System.Collections.Generic; using System.Linq; using System.Text;using Microsoft.Office.Core;namespa…前面两篇博客讲解了怎么通过程序控制word的生成包括生成文字、添加表格、添加图片等。这篇博客主要说一下怎么把word图片转换成pdf。 using System; using System.Collections.Generic; using System.Linq; using System.Text;using Microsoft.Office.Core;namespace PDFTest {class PDFUtil{/// summary/// 把Word文件转换成为PDF格式文件/// /summary/// param namesourcePath源文件路径/param/// param nametargetPath目标文件路径/param /// returnstrue转换成功/returnspublic static bool WordToPDF(string sourcePath, string targetPath){bool result false;Microsoft.Office.Interop.Word.WdExportFormat exportFormat Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF;Microsoft.Office.Interop.Word.ApplicationClass application null;Microsoft.Office.Interop.Word.Document document null;try{application new Microsoft.Office.Interop.Word.ApplicationClass();application.Visible false;document application.Documents.Open(sourcePath);document.SaveAs2();document.ExportAsFixedFormat(targetPath, exportFormat);result true;}catch (Exception e){Console.WriteLine(e.Message);result false;}finally{if (document ! null){document.Close();document null;}if (application ! null){application.Quit();application null;}GC.Collect();GC.WaitForPendingFinalizers();GC.Collect();GC.WaitForPendingFinalizers();}return result;}/// summary/// 把Microsoft.Office.Interop.Excel文件转换成PDF格式文件/// /summary/// param namesourcePath源文件路径/param/// param nametargetPath目标文件路径/param /// returnstrue转换成功/returns//public static bool ExcelToPDF(string sourcePath, string targetPath)//{// bool result false;// Microsoft.Office.Interop.Excel.XlFixedFormatType targetType Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF;// object missing Type.Missing;// Microsoft.Office.Interop.Excel.ApplicationClass application null;// Microsoft.Office.Interop.Excel.Workbook workBook null;// try// {// application new Microsoft.Office.Interop.Excel.ApplicationClass();// application.Visible false;// workBook application.Workbooks.Open(sourcePath);// workBook.SaveAs();// workBook.ExportAsFixedFormat(targetType, targetPath);// result true;// }// catch (Exception e)// {// Console.WriteLine(e.Message);// result false;// }// finally// {// if (workBook ! null)// {// workBook.Close(true, missing, missing);// workBook null;// }// if (application ! null)// {// application.Quit();// application null;// }// GC.Collect();// GC.WaitForPendingFinalizers();// GC.Collect();// GC.WaitForPendingFinalizers();// }// return result;//}/// summary/// 把PowerPoint文件转换成PDF格式文件/// /summary/// param namesourcePath源文件路径/param/// param nametargetPath目标文件路径/param /// returnstrue转换成功/returns//public static bool PowerPointToPDF(string sourcePath, string targetPath)//{// bool result;// Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType targetFileType Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsPDF;// object missing Type.Missing;// Microsoft.Office.Interop.PowerPoint.ApplicationClass application null;// Microsoft.Office.Interop.PowerPoint.Presentation persentation null;// try// {// application new Microsoft.Office.Interop.PowerPoint.ApplicationClass();// //application.Visible MsoTriState.msoFalse;// persentation application.Presentations.Open(sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);// persentation.SaveAs(targetPath, targetFileType, Microsoft.Office.Core.MsoTriState.msoTrue);// result true;// }// catch (Exception e)// {// Console.WriteLine(e.Message);// result false;// }// finally// {// if (persentation ! null)// {// persentation.Close();// persentation null;// }// if (application ! null)// {// application.Quit();// application null;// }// GC.Collect();// GC.WaitForPendingFinalizers();// GC.Collect();// GC.WaitForPendingFinalizers();// }// return result;//}/// summary/// 把Visio文件转换成PDF格式文件/// /summary/// param namesourcePath源文件路径/param/// param nametargetPath目标文件路径/param /// returnstrue转换成功/returns//public static bool VisioToPDF(string sourcePath, string targetPath)//{// bool result;// Microsoft.Office.Interop.Visio.VisFixedFormatTypes targetType Microsoft.Office.Interop.Visio.VisFixedFormatTypes.visFixedFormatPDF;// object missing Type.Missing;// Microsoft.Office.Interop.Visio.ApplicationClass application null;// Microsoft.Office.Interop.Visio.Document document null;// try// {// application new Microsoft.Office.Interop.Visio.ApplicationClass();// application.Visible false;// document application.Documents.Open(sourcePath);// document.Save();// document.ExportAsFixedFormat(targetType, targetPath, Microsoft.Office.Interop.Visio.VisDocExIntent.visDocExIntentScreen, Microsoft.Office.Interop.Visio.VisPrintOutRange.visPrintAll);// result true;// }// catch (Exception e)// {// Console.WriteLine(e.Message);// result false;// }// finally// {// if (application ! null)// {// application.Quit();// application null;// }// GC.Collect();// GC.WaitForPendingFinalizers();// GC.Collect();// GC.WaitForPendingFinalizers();// }// return result;//}} }程序中包含了各种office格式转换pdf的代码在使用之前一定要加载对应的COM库进来然后才可以使用。转载于:https://www.cnblogs.com/stemon/p/4617561.html
http://www.pierceye.com/news/563533/

相关文章:

  • 昌邑建设局网站北京seo优化wyhseo
  • 网站访客抓取新媒体营销课程心得体会
  • 网站建设售前域名注册
  • 运动器材网站开发方案失信被执行人名单查询系统
  • 深圳商业网站建设模板网站建设worldpress
  • 宁波网站排名网站开发 哪家好
  • 做网站的软件工程师网站积分程序怎么建设
  • ps网站轮播图怎么做动漫制作专业的来源
  • 怎么知道一个网站是谁做的建筑认证
  • 网站关键词优化排名公司网站备案的意思
  • 怎么把qq空间做成企业网站医疗网站设计
  • 个人博客网站需求分析上海最大企业前十名
  • 兴义之窗网站怎么做网页界面设计的类别
  • 黄南州网站建设公司安徽省建设厅执业资格注册中心网站
  • wordpress布置网站教程wordpress it模板下载地址
  • 网站首页栏目设置宿州建设网站公司哪家好
  • 西安网站建设怎么接单做社交的招聘网站
  • 实训课网站开发个人小结横岗做网站
  • 网站集约化建设管理方案wordpress加cnzz统计在那里加
  • 重庆知道推广网站方法青岛网络推广的有哪些公司
  • 自己做网站服务器要多少钱特殊字体
  • 网站建设合同 协议书网站建设工具有哪些
  • 网站建设的基本条件网站建设策划案怎么写
  • 知乎网站开发用的语言郑州建设网站哪家好
  • 企业官网建站费用长沙做无痛肠镜东大医院l网站
  • 建网站资料wordpress 读书模板
  • 网站建设初学者教程成华区微信网站建设公司
  • 沈阳网站建设-中国互联商城页面
  • 成交型网站倡导公司进贤南昌网站建设公司
  • 网站跟软件有什么区别是什么点击器原理