Aspose实现Office转PDF (ASP.NET)
2015-11-24 14:09
721 查看
0.添加Aspose的DLL
[align=center][/align]1.可以直接去官网下载,不过默认是带水印的,如需去除水印可以购买
2.当然也可以在国内的一些下载站下载
3.将Aspose.Cells.dll、Aspose.Words.dll 两个文件添加到项目的bin目录下
4.给大家提供一个学习用地址:http://www.dxper.net/thread-4028-1-1.html
PS:ppt转pdf用.net2.0文件夹下的Aspose.Slides.dll即可
1.Word转PDF
[align=center][/align]1.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Aspose.Words; using Aspose.Words.Saving; using System.IO; using System.Drawing; using System.Text; using Aspose.Cells; public partial class Word2PDF : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Document doc = new Document(@"C:\Users\DUANCHENGHUA\Desktop\质量月PPT\2015年质量月活动方案 - 副本.doc"); doc.Save(@"C:\Users\DUANCHENGHUA\Desktop\2015年质量月活动方案 - 副本.pdf", Aspose.Words.SaveFormat.Pdf); } }
2.Excel转PDF、PPT转PDF
[align=center][/align]1.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Aspose.Words; using Aspose.Words.Saving; using System.IO; using System.Drawing; using System.Text; using Aspose.Cells;//Excel using Aspose.Slides;//PPT public partial class Word2PDF : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { //Excel Workbook excel = new Workbook(@"C:\Users\DUANCHENGHUA\Desktop\数据库信息表.xlsx"); excel.Save(@"C:\Users\DUANCHENGHUA\Desktop\数据库信息表.pdf", Aspose.Cells.SaveFormat.Pdf); //PPT Presentation ppt = new Presentation(@"C:\Users\DUANCHENGHUA\Desktop\2015年质量月活动1509.ppt"); ppt.Save(@"C:\Users\DUANCHENGHUA\Desktop\2015年质量月活动1509.pdf", Aspose.Slides.Export.SaveFormat.Pdf); //PPTX Aspose.Slides.Pptx.PresentationEx pptx = new Aspose.Slides.Pptx.PresentationEx(@"C:\Users\DUANCHENGHUA\Desktop\演示文稿1.pptx"); pptx.Save(@"C:\Users\DUANCHENGHUA\Desktop\演示文稿1.pdf", Aspose.Slides.Export.SaveFormat.Pdf); } }
来自为知笔记(Wiz)
相关文章推荐
- asp生成xml文件
- 电商安全无小事,如何有效地抵御 CSRF 攻击?
- 再看 AspriseOCR - OCR应用开发
- 电商安全无小事,如何有效地抵御 CSRF 攻击?
- Asp.Net 之 调用远程Web_Service
- Asp.Net 之 获取GridView行的DataKeys
- ASP.NET中RouteValueDictionary的一点理解
- ASP.NET中怎样实现图片验证码功能,并且点击图片会刷新
- asp.net内置对象 Response对象使用介绍
- ASP.NET MVC 开源项目学习之ProDinner (二)
- aspx.cs上传文件
- Using OpenCV with the Raspberry Pi camera
- asp.net和js读取文件的MD5值的方法
- ASP.NET配置KindEditor文本编辑器
- ASP.NET动态网站制作(29)-- 正则
- ASP.NET 5 使用 TestServer 进行单元测试
- URL路径中包含特殊字符%的处理
- ASP.NET静态页生成方法(模板替换)
- ASP.NET获取用户端的真实IP
- ASP.NET 5升级后如何删除旧版本的DNX