PowerPoint use of AddOLEObject

  • Thread starter Thread starter Tom Welch
  • Start date Start date
T

Tom Welch

I've written a Perl script using Win32OLE to command PowerPoint to
build a presentation. I've used the following to insert a graphic
file in one of the slides:

$Slide1->Shapes->AddOLEObject({FileName=>$trend,
Left=>225,
Top=>125,
Width=>480,
Height=>320,
DisplayAsIcon=>0,
Link=>0,});

where $trend is the path to the graphic. This works fine when running
the Perl script on my desktop.
Ultimately I want to incorporate the Ppt capability in a web
based app also written is perl. The problem is when the script that
works on my desktop runs via the webserver the graphic doesn't get
inserted. Instead a small windows icon with the name of the file is
displayed. There's another method called AddPicture which
successfully inserts the graphic but the resolution of the added
picture is significantly less than when the AddOLEObject method is
used (based on desktop success).
Our IT folks have built a PowerPoint broker app that web apps
must use in order run ppt on the webserver. The idea is to avoid
having different apps all trying to run ppt at the same time.
Anyway, I suspect that my problem stems from some persmission
issue. I'm guessing that the id running the ppt process is lacking
some permission that I have when logged into my desktop pc. Maybe
there is some windows directory that must be accessed when using the
AddOLEObject method that the id of the broker does not have access to.
Our IT folks have run out of ideas to try and solve this. I sure
would appreciate some help on this.

Thanks
Tom Welch
 
See inline ...

I've written a Perl script using Win32OLE to command PowerPoint to
build a presentation. I've used the following to insert a graphic
file in one of the slides:

$Slide1->Shapes->AddOLEObject({FileName=>$trend,
Left=>225,
Top=>125,
Width=>480,
Height=>320,
DisplayAsIcon=>0,
Link=>0,});

where $trend is the path to the graphic. This works fine when running
the Perl script on my desktop.
Ultimately I want to incorporate the Ppt capability in a web
based app also written is perl. The problem is when the script that
works on my desktop runs via the webserver the graphic doesn't get
inserted. Instead a small windows icon with the name of the file is
displayed.

What format is the file you're adding in this case?
And more to the point, what happens when you close PowerPoint and doubleclick
the picture file's icon on both your desktop and on the server?

If the results are different, there's the culprit: a different app "owns" the
graphic's file type on your desktop than on the server (and possibly the
filetype isn't registered to any app on the server, hence the generic Windows
icon).
 
Steve Rindsberg said:
What format is the file you're adding in this case?
And more to the point, what happens when you close PowerPoint and doubleclick
the picture file's icon on both your desktop and on the server?

If the results are different, there's the culprit: a different app "owns" the
graphic's file type on your desktop than on the server (and possibly the
filetype isn't registered to any app on the server, hence the generic Windows
icon).
The file is a png (portable network graphic) If I double click on the
icon on my desktop this message appears: 'You are about to activate an
inserted object that might contain viruses or otherwise be harmful to
your computer. ... Do you want to continue ?' I clicked Yes and then
I was asked what app I wanted to use. I tried a number of apps like
MS PhotoDraw, MS Photo Editor, other image viewers but none were able
to display anything. For example, MS Photo Editor replied 'Unknown
file format' If I copy the icon to my desktop and double click, it
opens correctly in MS Photo Editor. I don't have access to try this
on the server. Some time ago I had someone from our client server
team run my script while logged into the server and it produced a ppt
file with the image displayed. That sounds to me like the filetype is
registered on the server. Do filetype registrations vary depending on
the identity of the user ?
 
Tony, see in-line ...
The file is a png (portable network graphic) If I double click on the
icon on my desktop this message appears: 'You are about to activate an
inserted object that might contain viruses or otherwise be harmful to
your computer. ... Do you want to continue ?'

This suggests a possible problem - my guess is that you may have drag/dropped the PNG
into PPT, or inserted it as an Object. Unless you've a good reason for doing that,
it's best to do Insert, Picture, From File instead. That will solve all the "Who owns
what" problems completely.
I clicked Yes and then
I was asked what app I wanted to use. I tried a number of apps like
MS PhotoDraw, MS Photo Editor, other image viewers but none were able
to display anything. For example, MS Photo Editor replied 'Unknown
file format' If I copy the icon to my desktop and double click, it
opens correctly in MS Photo Editor. I don't have access to try this
on the server. Some time ago I had someone from our client server
team run my script while logged into the server and it produced a ppt
file with the image displayed. That sounds to me like the filetype is
registered on the server. Do filetype registrations vary depending on
the identity of the user ?

a) The fact that the image is in PPT doesn't mean that the filetype is registered. PPT
natively reads PNGs.

b) Registration can vary depending on the user, yes.

Again, for PNGs, Insert, Picture, From File will solve all this. And for existing
files, it should be possible to rightclick the image, choose Grouping, Ungroup and
answer YES to the question that comes up next. That'll leave you with just the image
as a PPT shape, none of the OLE overhead that's causing your problem, it seems.
 
The png file being inserted is created on the fly based on a database
query. The returned data feeds into a perl module called DBD::Chart
which produces the png file. You can produce a very nice grapic using
this package. I have used the AddPicture method and it does work as
you suggest. The problem is the quality of the inserted picture is
much less than that of the original picture. While working on my
desktop I found that the AddOLEObject (Insert, Object, from File)
method resulted in a very crisp high quality rendering of the picure
in the presentation.
 
this package. I have used the AddPicture method and it does work as
you suggest. The problem is the quality of the inserted picture is
much less than that of the original picture.

In what way? And are you comparing it in slide editing view or slideshow view?
While working on my
desktop I found that the AddOLEObject (Insert, Object, from File)
method resulted in a very crisp high quality rendering of the picure
in the presentation.

But it's also probably the reason for the problem you're having. OLE objects carry
with them the id of the application that served them up. If that app isn't on
other computers, things go sour.
 
Back
Top