在asp.net中将图像导出到PPT [英] Export image to PPT in asp.net

查看:82
本文介绍了在asp.net中将图像导出到PPT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



谁能告诉我如何下载图片并嵌入到PPT中吗?
我尝试使用以下代码:

Hi,

Could anyone please tell me how to download an image and embed in PPT?
I tried using the below code:


sFileName = ThresholdChartPath + ".jpg";
Response.Clear();
            Response.ClearHeaders();
            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment;filename=SavetoPPT.ppt");
            Response.ContentType = "application/vnd.ms-powerpoint";
String imagepath = "<img src='"+ sFileName + "' width='780' height='480'/>"; 
Response.Output.Write(imagepath);                     
Response.Flush();
Response.End();


以及下面显示的代码:


and also the code shown below:


sFileName = ThresholdChartPath + ".jpg";
_powerPoint = new PowerPoint.Application();
                _presentation = _powerPoint.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoCTrue);
                int _slideNo = 0;
                _slideNo++;
                var slide = _presentation.Slides.Add(_slideNo,
                    Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutBlank);
slide.Shapes.AddPicture(sFileName,Microsoft.Office.Core.MsoTriState.msoTrue,Microsoft.Office.Core.MsoTriState.msoTrue, 2, 2, 710, 530);
releaseObject(_powerPoint);
                releaseObject(_presentation);

在我的本地计算机上工作正常.
但是在网站在服务器中发布后,我无法从服务器端下载它.
任何人都可以帮忙.

预先感谢.

It works fine in my local machine.
But i''m not able to download it from the server side after the website is published in the server.
Anyone please help it.

Thanks in advance.

推荐答案

是的,使用try,catch,并查看Server上的异常是什么,
服务器上可能未安装Microsoft Office的可能性.
而且无法创建PPT文件

[edit]不必要的代码块已删除[/edit]
Yes, Use try , catch , And see what is the exception at Server,
There might be a possibility that Microsoft office is not installed at Server
And not able toi create PPT files

[edit]unnecesary code block removed[/edit]


这篇关于在asp.net中将图像导出到PPT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆