AddOleObjectFrame
内容
[
隐藏
]AddOleObjectFrame(float, float, float, float, IOleEmbeddedDataInfo)
向集合的末尾添加新的 OLE 对象。
public IOleObjectFrame AddOleObjectFrame(float x, float y, float width, float height,
IOleEmbeddedDataInfo dataInfo)
参数 | 类型 | 说明 |
---|---|---|
x | Single | 新的 OLE 框的 X 坐标。 |
y | Single | 新的 OLE 框的 Y 坐标。 |
width | Single | 新的 OLE 框的宽度。 |
height | Single | 新的 OLE 框的高度。 |
dataInfo | IOleEmbeddedDataInfo | 嵌入数据信息 IOleEmbeddedDataInfo 。 |
返回值
创建的 OLE 对象。
示例
以下示例演示如何向 PowerPoint 演示文稿的幻灯片添加 OLE 对象框架。
[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);
}
另见
- interface IOleObjectFrame
- interface IOleEmbeddedDataInfo
- class ShapeCollection
- namespace Aspose.Slides
- assembly Aspose.Slides
AddOleObjectFrame(float, float, float, float, string, string)
向集合的末尾添加新的 OLE 对象。
public IOleObjectFrame AddOleObjectFrame(float x, float y, float width, float height,
string className, string path)
参数 | 类型 | 说明 |
---|---|---|
x | Single | 新的 OLE 框的 X 坐标。 |
y | Single | 新的 OLE 框的 Y 坐标。 |
width | Single | 新的 OLE 框的宽度。 |
height | Single | 新的 OLE 框的高度。 |
className | String | OLE 类的名称。 |
path | String | 链接文件的路径。 |
返回值
创建的 OLE 对象。
另见
- interface IOleObjectFrame
- class ShapeCollection
- namespace Aspose.Slides
- assembly Aspose.Slides