Please see my code below.
My problem is that when I write this word doc to the disk, it comes in as garbled text only. I open it in MS Word and it is all garbled text. Same thing happens with Excel files.
Please tell what am I missing here?
Also if i apply the same code to embedded pdf files, they come out perfect.
My code below:
Presentation pres = new Presentation(path);
int filenum = 0;
foreach(Slide slide in pres.Slides)
{
foreach (Aspose.Slides.Shape shape in slide.Shapes)
{
filenum += 1;
if (shape.ToString().Contains("OleObjectFrame"))
{
string fileName = @"C:\temp\testAsposeSlides" + filenum + ".doc";
OleObjectFrame oleOF = shape as OleObjectFrame;
FileStream fstr = new FileStream(fileName, FileMode.Create, FileAccess.Write);
byte[] buf = oleOF.ObjectData;
fstr.Write(buf, 0, buf.Length);
fstr.Flush();
fstr.Close();
}
}
}