String in XML to GIF file in PowerPoint

K

kriti642

Hi Everyone,


I have an XML file and a powerpoint placeholder template. In the macro
,behind the ppt template , I parse the XML file and after getting the
information generate the ppt. Till date I had been creating the images
in ppt from the data in XML. Now I have a image in XML (in Sting format
converted from bytes). I need to read this in the macro and show the
image at the place holder position on the powerpoint slide.

How do I do this? Any ideas?????

One idea I got was to read the sting , find someway of converting into
byte in VBA and writing it into a file and pasting the file into the
powerpoint. Is this feasible? If so can someone point me in the right
direction please...

Thanks
Kriti
 
S

Steve Rindsberg

Hi Everyone,

I have an XML file and a powerpoint placeholder template. In the macro
,behind the ppt template , I parse the XML file and after getting the
information generate the ppt. Till date I had been creating the images
in ppt from the data in XML. Now I have a image in XML (in Sting format
converted from bytes). I need to read this in the macro and show the
image at the place holder position on the powerpoint slide.

How do I do this? Any ideas?????

One idea I got was to read the sting , find someway of converting into
byte in VBA and writing it into a file and pasting the file into the
powerpoint. Is this feasible? If so can someone point me in the right
direction please...

If the XML data is something like a hex string representation of the data from
the original GIF file:

Sub thing()

Dim sString As String
Dim aBytes() As Byte
Dim x As Long

' example string only; you'd use your string data here:
' assuming each original byte is expressed as a two char string
' in the range "00" to "FF"
sString = "0102031013ff"

' size the array to half the length of the string
ReDim aBytes(1 To Len(sString) / 2) As Byte

' Convert each two characters of the string into a single
' byte, store it in the array:
For x = 2 To Len(sString) Step 2

' Show the original and converted values to the human
Debug.Print Mid$(sString, x - 1, 2) _
& " --> " _
& CByte(Val("&H" & Mid$(sString, x - 1, 2)))

aBytes(x / 2) = CByte(Val("&H" & Mid$(sString, x - 1, 2)))

Next

' write the contents of aBytes to file and you should have your GIF
' use something like this to add the gif to a slide:
Dim oSh as Shape
Set oSh =
ActivePresentation.Slides(1).Shapes.AddPicture("giffile.gif",false,true,
0,0,100,100)
' scale it to its "natural" size
With oSh
.Scaleheight 1, msoTrue
.Scalewidth 1, msoTrue
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top