Hi,
First of all congrats for having such a cool product on file formats. I am having a issue in extracting the OLE object saved in a ppt file. I had created an empty slide , followed by inserting a “Bitmap Image” object into the slide and saved it in Powerpoint. I opened the file using slides and I had saved the ole
data from OleObjectFrame’s getObjectData() function. Now my question is the data i got is neither a valid bitmap file nor a valid OLE file. So can I know what should i do further to get the desired result. I followed your code sample, but its not working for me. I am getting the same issue for organization chart object too. I like to put forward this issue if not addressed before.
Good day,
Thanks & Regards,
manu
Hello,
I have created a workaround to access the BITMAP image. Please see the code below. I have also attached the source presentation and the output image extracted by it.
Please read the comments.
C#
//Read the presentation
Presentation pres = new Presentation("C:\\Test\\source.ppt");
//Access the first slide
Slide sld = pres.GetSlideByPosition(1);
//Access the bitmap ole object
OleObjectFrame oof = sld.Shapes[0] as OleObjectFrame;
//Convert the bitmap ole object data to string
string str = System.Text.Encoding.ASCII.GetString(oof.ObjectData);
//Find the index of BM6, bitmap image starts from it
int bmpIndex = str.IndexOf("BM6");
//Create the bitmap image on disk
//Write the data that starts from the above index till end
FileStream fout = new FileStream("c:\\test\\output.bmp", FileMode.Create, FileAccess.Write);
fout.Write(oof.ObjectData, bmpIndex, (oof.ObjectData.Length - bmpIndex));
fout.Close();
Hi,
Thanks for the reply. The solution is working too.
great job,
Regards,
manu