keyongtech


  keyongtech > powerpoint > 09/2005

 #1  
09-19-05, 02:19 PM
AD
I am writing an add-in that loops through a PowerPoint application and
exports all the included images. The problem is when I export the image
I need to specify a format (file type), however I can't find any way to
grab the format (file type) of the picture object or OLE object.

I hope I am just missing a reference; however I have looked endlessly
and can't find a solution.

Any help would be appreciated,

AD
 #2  
09-19-05, 02:30 PM
Shyam Pillai
AD,
No known native way to extract the format of the images stored within
PowerPoint. The hack is as follows:

Parse the HTML project for the slide. From which you can arrive at the
source property for the shape which will give you the filename and extension
of the original image.

This is a hack which works on 2000+ versions.
' ----- Beginning Of Code -----
Option Explicit


Function GetImageExtension(oCheckCopy As Object)
On Error GoTo ExitImageExtensionError
Dim oTmpPPT As Object
Dim sHTMLString As String
Dim sBuff As String


oCheckCopy.Copy
Set oTmpPPT = Presentations.Add(False)
With oTmpPPT.Slides.Add(1, ppLayoutBlank)
.Shapes.Paste
End With
sHTMLString = oTmpPPT.HTMLProject.HTMLProjectItems("Slide1").Tex t
If InStr(1, sHTMLString, "<v:imagedata src=" & Chr(34)) <> 0 Then
sBuff = Mid(sHTMLString, _
InStr(1, sHTMLString, "v:imagedata src=" & Chr(34)) _
+ Len("v:imagedata src=") + 1)
sBuff = Left(sBuff, InStr(1, sBuff, Chr(34)) - 1)
sBuff = Mid(sBuff, InStrRev(sBuff, ".") + 1)
End If
ExitImageExtensionError:
GetImageExtension = sBuff
oTmpPPT.Close
Set oTmpPPT = Nothing
End Function

Sub Test()
Dim sExt As String
Dim oShp As Shape
Set oShp = ActiveWindow.Selection.ShapeRange(1)
sExt = GetImageExtension(oShp)
MsgBox sExt
End Sub
' ----- End Of Code -----
 #3  
09-19-05, 03:22 PM
Steve Rindsberg
In article <1127135980.345180.109910>, Ad wrote:
> I am writing an add-in that loops through a PowerPoint application and
> exports all the included images. The problem is when I export the image
> I need to specify a format (file type), however I can't find any way to
> grab the format (file type) of the picture object or OLE object.


PowerPoint doesn't necessarily retain the original file type when you Insert a
picture from file. The image will be converted internally to GIF, JPG or PNG,
depending on the image characteristics (or if the image is JPG or PNG to begin
with, it'll stay that way).

IOW, if you're looking for TIFF In, TIFF Out, you can't get there from here.

If you save as web page from PPT 2000 or higher, you'll get the full resolution
image that PPT's holding internally (ie, after conversion to JPG/PNG/etc) among
all the other litter of support files.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Similar Threads
recover powerpoint file that was converted to object type

While openiing a powerpoint file embedded as an icon in a Word.doc file, I right-clicked on the embedded icon, and Selected "Convert", which changed the file into a...

Build failed. Compiler for file type '*.xsd' failed. Object reference not set to an instance of an object.

Hi! I'm receiving this message for xsd,odx and btm files. I tried repairing BizTalk installation couple of times but without any success. Please don't tell me that I have to...

How do I format embeded object in powerpoint?

I'm trying to embed and link Excel spread sheet with charts into a power point slide. The worksheet is landscape. The embeded object cuts off part of the Right hand side of...

Activating COM object via file extension

Hi. Is it possible to register a COM object with Windows (Win2k specifically) in such a way that when the user dbl-clicks a file with a given file extension in Explorer, the...

Can I write to a File object from a C extension?

I have a function written in C that wants to write to a FILE * returned from fopen. I'd like to use this function to write to a File object that has been opened for output by...


All times are GMT. The time now is 05:42 AM. | Privacy Policy