Hi,
I want to insert an OLE object to the Presentation(pptx) file. And the OLE is a excel(.xlsx) file which is stored in the physical location. Please help me.
Refer the attached image for more details.
Thanks,
Laxmikanta
Hi,
Hi Laxmikanta,
Hi Mudassir,
//Instantiate PrseetationEx class that represents the PPTX
PresentationEx pres = new PresentationEx();
//Access the first slide
SlideEx sld = pres.Slides[0];
//Load an Excel file to stream
FileStream fs = new FileStream("d:\\pptx\\Copy of GridCheck.xls", 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, pres.SlideSize.Size.Width, pres.SlideSize.Size.Height, "Excel.Sheet.8", mstream.ToArray());
//Write the PPTX to disk
pres.Write("d:\\pptx\\OleEmbed.pptx");</span></font></pre><pre class="code-java" style="padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: 'Courier New', Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 13px; background-color: rgb(255, 255, 255);"><br></pre><pre class="code-java" style="padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: 'Courier New', Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 13px; background-color: rgb(255, 255, 255);">Thanks,</pre><pre class="code-java" style="padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: 'Courier New', Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 13px; background-color: rgb(255, 255, 255);">Laxmikanta</pre></div><div><br></div><div><br></div>
Hi Laxmikanta,
Hi Mudassir,
Hi Laxmikanta,