I have almost finished converting my script that generated Powerpoint 2003 files to generate Powerpoint 2007. When I save the file (presentationex.write) the slide appears exactly as it should. When I generate a thumbnail the images do not appear correctly. I am generating a thumbnail and then displaying that on the web. There should be two images pulled from a file, and in each case the shape is put in the right spot, but it is filled with green instead of showing the image.
At first, I had an issue with the saved file, that each image would be enclosed in a green box. I added
pshp.LineFormat.Width = Convert.ToDouble(0.0)
pshp.LineFormat.FillFormat.FillType = FillTypeEx.NoFill
This removed the green box from around the images in the saved file but did not effect the thumbnail.
Code snippet:
(pass in pres as PresentationEx)
Dim slide As Slideex
slide = pres.Slides(0)
'populate image
Dim pidx As Integer = slide.Shapes.AddAutoShape(ShapeTypeEx.Rectangle, 535, 61, 194, 104)
Dim pshp As ShapeEx = slide.Shapes(pidx)
pshp.FillFormat.FillType = FillTypeEx.Picture
pshp.FillFormat.PictureFillFormat.PictureFillMode = PictureFillModeEx.Stretch
pshp.LineFormat.Width = Convert.ToDouble(0.0)
pshp.LineFormat.FillFormat.FillType = FillTypeEx.NoFill
resizeImage(projectid, 1549, 910)
Dim pic2 As System.Drawing.Image = CType(New Bitmap(AppSettings("exportLocation") + "imgtest.jpg"), Image)
Dim ProjectPic As ImageEx = pres.Images.AddImage(pic2)
pshp.FillFormat.PictureFillFormat.Picture.Image = ProjectPic
'Getting Thumbnail
Dim image As System.Drawing.Image
image = slide.GetThumbnail(1.0F, 1.0F)
'Initializing Memory Stream
Dim ImageMs As System.IO.MemoryStream
ImageMs = New System.IO.MemoryStream()
'Saving image to memory stream
image.Save(ImageMs, System.Drawing.Imaging.ImageFormat.Jpeg)
ImageMs.Position = 0
'Intializing buffer
Dim pBuffer(ImageMs.Length) As Byte
'Memory stream to buffer
ImageMs.Read(pBuffer, 0, ImageMs.Length)
'write the image to the output stream
Response.ContentType = "image/jpeg"
Response.OutputStream.Write(pBuffer, 0, pBuffer.Length)
Response.End()
I appreciate any help with this.