Click here to Skip to main content
Rate this: bad
good
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
Edited 14-Nov-12 21:45pm
v10
Comments
shabari7 at 15-Nov-12 3:56am
   
Write to log....
skkworld at 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 at 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
0 Maciej Los 404
1 OriginalGriff 369
2 Sergey Alexandrovich Kryukov 158
3 CPallini 145
4 Hard_Rockz 85
0 OriginalGriff 5,634
1 Sergey Alexandrovich Kryukov 4,763
2 Peter Leow 2,954
3 Maciej Los 2,614
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web02 | 2.8.140718.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid