Inserting Image to the Powerpoint slide using C# from remote jpg f

  • Thread starter Thread starter Hriday
  • Start date Start date
H

Hriday

Hi,
I am using Microsoft.Office.Interop.PowerPoint (office 2007) to create a PPT
slide from my C# code. I want to display an image on my slide from a jpg file
which is located at different file server. When I use following line to add
image by giving the file path strPicPath, it displays the image if strPicPath
is a path of a .jpg file of my application server. But it generates error
when I change strPicPath to a remote file server path. Because file server
path is not accessible from my application server for security reason. But
client machine does have access to the file server path. I tried linking the
image file using MsoTriState.msoTrue, but seems it still needs the .jpg file
to create the image.

objSlide.Master.Shapes.AddPicture(strPicPath, MsoTriState.msoTrue,
MsoTriState.msoFalse, 398, 43, 309, 200);

My requirement is to display the image on the Slide from a given .jpg file.
And I am able to do this by using the Shapes.AddPicture and providing the
path of .jpg file.

The problem comes when .jpg file is not accessible, this means when I use
the path of a local jpg file it works fine, and when I use the remote path
for jpg file (a different file server) then it does not work because my C#
code can not access the jpg file located at file server (because application
server does not have access permission to jpg file on file server). But the
actual end users of application do have the access to the jpg image file.

That is why I am looking if there is a way to just give the path of jpg file
in my server side coding and it can be rendered (displayed) on the PPT at
client side. I can not create the image at server side as my Application
server can not access the jpg file.

Is there any way to just create a blank image in PPT with a link to a .jpg
file so that when that PPT is opened at client machine, image is displayed
using the .jpg file from the file server? My scenario is something like using
href in html with a remote image path, but I do not know how to do this in
PPT using C#.

Thank you very much for any help.
 
Back
Top