We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Embedding Excel Table object to a slide

Hi,


I have an issue in embedding an excel table object to a slide. Code snippet is as below…
Attached is my excel object file and output should be as attached output file…

private void ExcelObjectInSlide()
{
Aspose.Slides.License license = new Aspose.Slides.License();
license.SetLicense(“Aspose.Slides.lic”);
PresentationEx pres = new PresentationEx();
SlideExCollection slds = pres.Slides;
slds.AddEmptySlide(pres.LayoutSlides[0]);
//Load the PPTX to Presentation object
//Presentation pres = new Presentation(“OleEmbed.pptx”);

//Access the first slide
SlideEx sld = pres.Slides[0];


//Access the first slide
string path=“C:\Documents and Settings\csthadi\My Documents\Downloads\”;

//Load an cel file to stream
FileStream fs = new FileStream(path + “ProductPerformance.xlsx”, FileMode.Open, FileAccess.Read);
MemoryStream mstream = new MemoryStream();
byte[] buf = new byte[4096];

while (true)
{
int bytesRead = fs.Read(buf, 0, buf.Length);
if (bytesRead <= 0)
break;
mstream.Write(buf, 0, bytesRead);
}

//Add an Ole Object Frame shape
OleObjectFrameEx oof = sld.Shapes.AddOleObjectFrame(0, 0, 700, 530, “Excel.Sheet.12”, mstream.ToArray());


//Write the PPTX to disk
pres.Save(“OleEmbed.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);
}

Thanks,
Narayan

Hi Narayan,

I have observed the requirements shared by you and like to share that whenever you add an ole object frame to slide, it gets added in disabled form. The red message show “Embedded Object” highlights that Ole object has been added but it is in not activated. One need to active the Ole frame to show the Ole object content. There are two approaches that one can use in this regard. First is to use third party macros that will look for embedded ole objects inside presentation and activate the Ole frames whenever presentation is opened. You may please follow this documentation link for your kind reference in this regard to have an idea. But you need to look for available options for use of third party to the job for you on your end in this regard.

Many Thanks,