AddOleObjectFrame
Contents
[
Hide
]AddOleObjectFrame(float, float, float, float, IOleEmbeddedDataInfo)
Adds a new OLE object to the end of a collection.
public IOleObjectFrame AddOleObjectFrame(float x, float y, float width, float height,
IOleEmbeddedDataInfo dataInfo)
Parameter | Type | Description |
---|---|---|
x | Single | X coordinate of a new OLE frame. |
y | Single | Y coordinate of a new OLE frame. |
width | Single | Width of a new OLE frame. |
height | Single | Height of a new OLE frame. |
dataInfo | IOleEmbeddedDataInfo | Embedded data info IOleEmbeddedDataInfo . |
Return Value
Created OLE object.
Examples
The following examples shows how to adding OLE Object Frames to Slides of PowerPoint Presentation.
[C#]
// Instantiates the Presentation class that represents the PPTX file
using (Presentation pres = new Presentation())
{
// Accesses the first slide
ISlide sld = pres.Slides[0];
// Loads an excel file to stream
MemoryStream mstream = new MemoryStream();
using (FileStream fs = new FileStream("book1.xlsx", FileMode.Open, FileAccess.Read))
{
byte[] buf = new byte[4096];
while (true)
{
int bytesRead = fs.Read(buf, 0, buf.Length);
if (bytesRead <= 0)
break;
mstream.Write(buf, 0, bytesRead);
}
}
// Creates a data object for embedding
IOleEmbeddedDataInfo dataInfo = new OleEmbeddedDataInfo(mstream.ToArray(), "xlsx");
// Adds an Ole Object Frame shape
IOleObjectFrame oleObjectFrame = sld.Shapes.AddOleObjectFrame(0, 0, pres.SlideSize.Size.Width,
pres.SlideSize.Size.Height, dataInfo);
//Writes the PPTX file to disk
pres.Save("OleEmbed_out.pptx", SaveFormat.Pptx);
}
See Also
- interface IOleObjectFrame
- interface IOleEmbeddedDataInfo
- class ShapeCollection
- namespace Aspose.Slides
- assembly Aspose.Slides
AddOleObjectFrame(float, float, float, float, string, string)
Adds a new OLE object to the end of a collection.
public IOleObjectFrame AddOleObjectFrame(float x, float y, float width, float height,
string className, string path)
Parameter | Type | Description |
---|---|---|
x | Single | X coordinate of a new OLE frame. |
y | Single | Y coordinate of a new OLE frame. |
width | Single | Width of a new OLE frame. |
height | Single | Height of a new OLE frame. |
className | String | Name of an OLE class. |
path | String | Path to the linked file. |
Return Value
Created OLE object.
See Also
- interface IOleObjectFrame
- class ShapeCollection
- namespace Aspose.Slides
- assembly Aspose.Slides