Click here to Skip to main content
13,139,254 members (52,713 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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

sFileName = ThresholdChartPath + ".jpg";
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment;filename=SavetoPPT.ppt");
            Response.ContentType = "application/";
String imagepath = "<img src='"+ sFileName + "' width='780' height='480'/>"; 

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;
                var slide = _presentation.Slides.Add(_slideNo,
slide.Shapes.AddPicture(sFileName,Microsoft.Office.Core.MsoTriState.msoTrue,Microsoft.Office.Core.MsoTriState.msoTrue, 2, 2, 710, 530);
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.
Posted 14-Nov-12 20:00pm
Updated 14-Nov-12 21:45pm
shabari7 15-Nov-12 3:56am
Write to log....
skkworld 22-Nov-12 1:48am
There is no error in log file in the server:(

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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]
skkworld 22-Nov-12 1:40am
I used try catch block but no exception thrown in the server.
The PPT export option works fine in the MS office version 2007 and below, but when i try to download in the system in which MS office version 2010 it shows me the following information in Event viewer "The Software Protection service has completed licensing status check. Event Id - 1003". And when i open the downloaded PPT file, it shows me an error as "Powerpoint can't read '*.ppt'".
Could You please help me to sort out the issue?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100