Hello,
Thanks for your inquiry and sorry for the late reply as weekend.
After an initial investigation, we found the OleObject implementation works only for word and excel at present. Some issue occurs in pdf and picture embedding and I have referred them to our Dev team for a further analysis and update. Once there's good news on it, I will inform you immediately.
Attache the code for embedding word and excel:
- Code: Select all
//use custom thumbnail
Image image = Image.FromFile(@"C:\Users\Administrator\Pictures\exp\pic.jpg");
Presentation ppt = new Presentation();
IImageData oleImage = ppt.Images.Append(image);
//1.add word document
Document doc = new Document();
doc.LoadFromFile(@"F:\test\doc\test.docx");
using (MemoryStream ms = new MemoryStream())
{
doc.SaveToStream(ms, Spire.Doc.FileFormat.Docx);
ms.Position = 0;
Spire.Presentation.IOleObject oleObject = ppt.Slides[0].Shapes.AppendOleObject("word", ms.ToArray(), new Rectangle(60, 60, 20, 20));
//oleObject.SubstituteImagePictureFillFormat.Picture.EmbedImage = oleImage;
oleObject.IsIconVisible = true;
oleObject.ProgId = "Word.Document.12";
}
//2.add embed excel
Workbook book = new Workbook();
book.LoadFromFile(@"F:\test\xls\limit.xlsx");
using (MemoryStream ms = new MemoryStream())
{
book.SaveToStream(ms, Spire.Xls.FileFormat.Version2010);
ms.Position = 0;
Spire.Presentation.IOleObject oleObject = ppt.Slides[0].Shapes.AppendOleObject("excel", ms.ToArray(), new Rectangle(100, 100, 20, 20));
//for convenience,just use the same image as example
oleObject.SubstituteImagePictureFillFormat.Picture.EmbedImage = oleImage;
oleObject.ProgId = "Excel.Sheet.12";
}
As for the name issue, sorry that I can't see the name even in ms office, could you show me a screenshoot?
Sincerely,
Jane
E-iceblue support team