C仿百度文库实现方法(已测试可行).docx

  1. 1、本文档共9页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C仿百度文库实现方法(已测试可行)

C# 仿百度文库在线查看功能资料发布到查看分为三个步骤:1、上传文件(doc、xls、ppt)转换成Pdf文件2、Pdf文件转换成swf文件3、把swf文件显示出来第一步:把上传的文件(doc、xls、ppt)转换成Pdf文件。直接在后台用代码转换,新建一个类,这一步没有什么特殊的要求,转换代码如下:using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using Word = Microsoft.Office.Interop.Word;using Excel = Microsoft.Office.Interop.Excel;using PowerPoint = Microsoft.Office.Interop.PowerPoint;using Microsoft.Office.Core;using System.Collections.Generic;using System.Linq;//注://using Word = Microsoft.Office.Interop.Word;//using Excel = Microsoft.Office.Interop.Excel;//using PowerPoint = Microsoft.Office.Interop.PowerPoint;//上面三个引用在添加引用的.NET标签中// using Microsoft.Office.Core;//上面这个引用在添加引用COM中的 Microsoft Office 12.0 Object Library/// <summary>///Office2Pdf 的摘要说明/// </summary>public class Office2Pdf{ /// <summary> /// Word转换成pdf /// </summary> /// <param name="sourcePath">源文件路径</param> /// <param name="targetPath">目标文件路径</param> /// <returns>true=转换成功</returns> public bool DOCConvertToPDF(string sourcePath, string targetPath) { bool result = false; Word.WdExportFormat exportFormat = Word.WdExportFormat.wdExportFormatPDF; object paramMissing = Type.Missing; Word.ApplicationClass wordApplication = new Word.ApplicationClass(); Word.Document wordDocument = null; try { object paramSourceDocPath = sourcePath; string paramExportFilePath = targetPath; Word.WdExportFormat paramExportFormat = exportFormat; bool paramOpenAfterExport = false; Word.WdExportOptimizeFor paramExportOptimizeFor = Word.WdExportOptimizeFor.wdExportOptimizeForPrint; Word.WdExportRange paramExportRange = Word.WdExportRange.wdExportAllDocument; int paramStartPage = 0; int paramEndPage = 0; Word.WdExportItem paramExport

文档评论(0)

almm118 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档