无法显示ppt图像 [英] can not show the ppt image

查看:62
本文介绍了无法显示ppt图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我有一个网页,我想在上面上传ppt文件,将其转换为imgage,然后将其显示为图像标签. ppt文件只有一张幻灯片.这是代码:

hi
i have a web page and i want to upload ppt file on it,convert it into imgage in show it into an image tag. the ppt file has one slide. here is the code:

protected void Page_Load(object sender, EventArgs e)
{
    ApplicationClass pptApplication = new ApplicationClass();
    Presentation pptPresentation = pptApplication.Presentations.Open("saifullah.ppt", MsoTriState.msoFalse,MsoTriState.msoFalse, MsoTriState.msoFalse);

    pptPresentation.Slides[1].Export("slid.jpg", "jpg", 320, 240);
    Image1.ImageUrl = pptPresentation.ToString();
}



当我调试页面时,它显示以下输出而不是图像.



When I debug the page it shows the following output instead of image.

Submit Query



有人可以告诉我问题出在哪里吗?

感谢您的时间!



Can somebody tell me where the problem is?

Thanks for your time!

推荐答案

这是您的代码中的问题:

Here''s the problem in your code:

protected void Page_Load(object sender, EventArgs e)
{
    ApplicationClass pptApplication = new ApplicationClass();
    Presentation pptPresentation = pptApplication.Presentations.Open("saifullah.ppt", MsoTriState.msoFalse,MsoTriState.msoFalse, MsoTriState.msoFalse);
    // Here you export the  slide as a JPG file which is OK
    // You should also specify a path in your file system where to the export should take place
    // and additionally this path should be exposed under some URL on your host
    String filePath;
    filePath = Server.MapPath("/Some/Virtual/Path/on/your/WebSite");
    filePath += "\\{0}";
    String fileName = "slid.jpg"; // This should be dynamic too so you can have more that one picture of a slide
    String fileNameAndPath = String.Format(filePath, "slid.jpg");
    pptPresentation.Slides[1].Export(fileNameAndPath, "jpg", 320, 240);
    Image1.ImageUrl = String.Format("/Some/Virtual/Path/on/your/WebSite/{0}", fileName);
}



问候,

—MRB



Regards,

—MRB


这篇关于无法显示ppt图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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