PDF/WORD/EXCEL/PPT 文档在线阅读
2016-11-20 19:07
633 查看
查资料看了2种解决方法:
1.通过办公软件dll转换,用flans去看
2.通过Aspose转换成pdf格式,在用js前台读pdf(我用的pdf.js)
今天我解决的就是WORD/EXCEL/PPT 转化成 PDF ,然后 PDF在线阅读
1.WORD/PPT/EXCEL转PPT类(很简单的)
View Code
3.效果如下
PPT :
![](https://images2015.cnblogs.com/blog/800090/201611/800090-20161120190523748-1688475387.jpg)
WORD:
![](https://images2015.cnblogs.com/blog/800090/201611/800090-20161120190552654-106832589.png)
4. DEMO: 下载 (新手上路,希望大家多多指点 )
1.通过办公软件dll转换,用flans去看
2.通过Aspose转换成pdf格式,在用js前台读pdf(我用的pdf.js)
今天我解决的就是WORD/EXCEL/PPT 转化成 PDF ,然后 PDF在线阅读
1.WORD/PPT/EXCEL转PPT类(很简单的)
private string upFile() { int iTotal = Request.Files.Count; if (iTotal == 0) { _msg = "没有数据"; } else { HttpPostedFile file = Request.Files[0]; string path = "file\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\"; string viewPath = "PDF\\web\\" + path; string ArticlePath = System.Web.HttpContext.Current.Server.MapPath("~") + viewPath; if (file.ContentLength > 0 || !string.IsNullOrEmpty(file.FileName)) { //建立图片主文件夹 if (!Directory.Exists(ArticlePath)) { Directory.CreateDirectory(ArticlePath); } saveName = Path.GetFileName(file.FileName); string extension = Path.GetExtension(file.FileName).ToLower(); string fileName = DateTime.Now.ToString("HH-mm-ss") + extension; ArticlePath += fileName; //保存文件 file.SaveAs(ArticlePath); string pdfpath = ArticlePath.Substring(0, ArticlePath.Length - extension.Length) + ".pdf"; if (extension == ".doc" || extension == ".docx") { office2pdf.DOCConvertToPDF(ArticlePath, pdfpath); } else if (extension == ".ppt" || extension == ".pptx") { office2pdf.PPTConvertToPDF(ArticlePath, pdfpath); } else if (extension == ".xls" || extension == ".xlsx") { office2pdf.XLSConvertToPDF(ArticlePath, pdfpath); } else if (extension == ".pdf") { } else { this.RegisterStartupScript("newWindow", "<script language='javascript'>alert('非法文件!')</script>"); return ""; } DelFile(ArticlePath); savePath = path + fileName.Substring(0, fileName.Length - extension.Length) + ".pdf"; return savePath; } } return ""; }
View Code
3.效果如下
PPT :
![](https://images2015.cnblogs.com/blog/800090/201611/800090-20161120190523748-1688475387.jpg)
WORD:
![](https://images2015.cnblogs.com/blog/800090/201611/800090-20161120190552654-106832589.png)
4. DEMO: 下载 (新手上路,希望大家多多指点 )
相关文章推荐
- Ubuntu 服务器 PHP实现word、excel、ppt、pdf 等文档在线阅读功能的实现
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)
- Android实现在线预览office文档(Word,Pdf,excel,PPT.txt等格式)
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- 类似百度文库在线预览文档flash版(支持word、excel、ppt、pdf)+在线预览文档html版
- java通过url在线预览Word、excel、ppt、pdf、txt文档中的内容【只获得其中的文字】
- ASP.NET Core2集成Office Online Server(OWAS)实现办公文档的在线预览与编辑(支持word\excel\ppt\pdf等格式)
- [Asp.net]常见word,excel,ppt,pdf在线预览方案,有图有真相,总有一款适合你!(续)
- 转载: Asp.net常见word,excel,ppt,pdf在线预览方案
- [Asp.net]常见word,excel,ppt,pdf在线预览方案,有图有真相,总有一款适合你!
- [Asp.net]常见word,excel,ppt,pdf在线预览方案,有图有真相,总有一款适合你!
- iphone开发 打开word,excel,ppt,txt,pdf文档