Click here to Skip to main content
12,504,695 members (63,817 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
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.
Posted 14-Nov-12 20:00pm
Updated 14-Nov-12 21:45pm
v10
Comments
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
 
good
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]
  Permalink  
v2
Comments
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 | Mobile
Web01 | 2.8.160919.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2016
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