使用aspose转换office文档/图片为pdf和html,支持在线浏览[附相关dll库]

9 篇文章 0 订阅

使用aspose转换office文档/图片为pdf和html,支持在线浏览[附相关dll库]

[dll下载地址] https://download.csdn.net/download/weixin_35607038/15710816

//excel转换
                Workbook workbook = new Workbook(HttpContext.Current.Server.MapPath(docpath + "/" + newFileName + sExtension));//找到转换文件
                string newFilePath = docpath + "NewFile/";
                string newuploadPath = HttpContext.Current.Server.MapPath(newFilePath);//找到转换后文件所存放的路径
                string newfileName = newFileName + ".pdf";
                string err = "";
                if (!Directory.Exists(newuploadPath))//没有此文件夹直接创建
                {
                    Directory.CreateDirectory(newuploadPath);
                }
                workbook.Save(HttpContext.Current.Server.MapPath(newFilePath + newfileName), Aspose.Cells.SaveFormat.Pdf);//转换中



 //word转换
                Aspose.Words.Document doc = new Aspose.Words.Document(HttpContext.Current.Server.MapPath(docpath + "/" + newFileName + sExtension));
                string newFilePath = docpath + "NewFile/";
                string newuploadPath = HttpContext.Current.Server.MapPath(newFilePath);
                string newfileName = newFileName + ".pdf";

                string err = "";
                if (!Directory.Exists(newuploadPath))
                {
                    Directory.CreateDirectory(newuploadPath);
                }
                doc.Save(HttpContext.Current.Server.MapPath(newFilePath + newfileName), Aspose.Words.SaveFormat.Pdf);


 //ppt转换
                Presentation pres = new Presentation(HttpContext.Current.Server.MapPath(docpath + "/" + newFileName + sExtension));
                string newFilePath = docpath + "NewFile/";
                string newuploadPath = HttpContext.Current.Server.MapPath(newFilePath);
                string newfileName = newFileName + ".pdf";
                string err = "";
                if (!Directory.Exists(newuploadPath))
                {
                    Directory.CreateDirectory(newuploadPath);
                }
                pres.Save(HttpContext.Current.Server.MapPath(newFilePath + newfileName), Aspose.Slides.Export.SaveFormat.Pdf);
转载于:https://www.cnblogs.com/snow1688/p/6439851.html

具体DLL请查我的资源库,可以下载,亲测无问题
[dll下载地址] https://download.csdn.net/download/weixin_35607038/15710816

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值