// The path to the documents directory.
const String outPath = u"../out/AddOLEObjectFrame_out.pptx";
const String filePath = u"../templates/book1.xlsx";


// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();

// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);

// Save file to memory stream 
{
	System::SharedPtr<System::IO::Stream> fileStream = System::IO::File::OpenRead(filePath);
	System::SharedPtr<System::IO::MemoryStream> MemStream = MakeObject< System::IO::MemoryStream>();

	System::ArrayPtr<uint8_t> buffer = System::MakeObject<System::Array<uint8_t>>(4 * 1024, 0);
	int32_t len;
	while ((len = fileStream->Read(buffer, 0, buffer->get_Length())) > 0)
	{
		MemStream->Write(buffer, 0, len);
	}
	MemStream->set_Position(0);

	// Add an Ole Object Frame shape
	System::SharedPtr<IOleObjectFrame> oof = slide->get_Shapes()->AddOleObjectFrame(0, 0, 720, 540, u"Excel.Sheet.12", MemStream->ToArray());
}


//Write the PPTX file to disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);