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

房子网站有哪些多语言网站建设价格

房子网站有哪些,多语言网站建设价格,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://wiki.neutronadmin.com/news/41926/

相关文章:

  • 自己做的网站不备案行吗网站文案设计
  • 网站推广服务好公司排名湖北勘察设计协会网站
  • 即墨网站制作wordpress后台总是404
  • 湘潭网站开发公司建设网络强国要有什么
  • wordpress 相册模式seo搜索优化排名
  • c 网站开发需要学什么软件网站建设情况
  • 做网站百科国外设计导航网站大全
  • 湖北手机网站建设进入公众号会有记录吗
  • 网站包503错误电子商务网站建设规划书范文
  • 如何分析网站用户体验织梦网站模板响应式
  • 高明区住房和城乡建设局网站免费订单管理app
  • 网站建设团队架构海尔的网络营销模式
  • 建公司网站要多少钱深圳网站制作公司流程图
  • 西安网站建设网络推广wordpress网页版入口看文
  • 太原广告公司网站建设wordpress让超链接不显示蓝字
  • 企业营销网站建设规划wordpress调用标签云
  • 汽车门户网站源码国外开源商城系统
  • 淮安市建设工程安全监督站网站泉州网站建站公司
  • 旅行社营业网点可以做网站吗lol中国战队
  • 2015网站备案没下来人力资源公司注册条件
  • 兰州财经大学网站开发与维护邹城网站建设哪家好
  • 网站建设软著网站demo制作
  • 如何给网站做关键字wordpress的母版页
  • 购物网站开发的背景与意义免费自助建站网站一览自助建站平台
  • 服装网上商城网站建设报告20最快的加载wordpress主题
  • 专业婚纱摄影网站制作哪些购物网站有做拼团活动
  • 网站源代码怎么放入 dede网站后台wordpress标签函数
  • 怎样网站制作设计浙江省网站建设与管理试卷
  • 做摄影网站的目的谷歌广告优化师
  • 给设计网站做图是商用吗中文域名交易网站