Skip to main content
All docs
V23.2

NestedShapeCollection.AddOleObjectAsIcon(String, String, Image, PointF) Method

Adds a linked OLE object to a shape group or a drawing canvas. The object is displayed in the document as an icon.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v23.2.Core.dll

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

[Browsable(false)]
NestedShape AddOleObjectAsIcon(
    string fileName,
    string progId,
    Image icon,
    PointF location
)

Parameters

Name Type Description
fileName String

A path to the file associated with the OLE object.

progId String

The file type. You can use constant fields of the OleObjectType class to set this value.

icon Image

The icon for the OLE object.

location PointF

An object that defines the object’s location (relative to the top left corner of the parent object). The Document.Unit property specifies measurement units.

Returns

Type Description
NestedShape

The OLE object in the group or drawing canvas.

Remarks

The example below shows how to group two OLE objects. Use the ShapeCollection.InsertGroup method to create a shape group. The Shape.GroupItems property returns a collection of group elements. Call the AddOleObjectAsIcon methods to add OLE objects to the group.

Group OLE Objects

Document document = wordProcessor.Document;
// Set measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch;
// Insert a shape group.
Shape group = document.Shapes.InsertGroup(document.Range.Start);
// Specify the group position relative to the left and top edges of the page. 
group.Offset = new PointF(1f, 6f);
// Access the collection of group items. 
var groupItems = group.GroupItems;
// Add the first OLE object to the group.
groupItems.AddOleObjectAsIcon(@"D:\ExcelWorkbook.xlsx", OleObjectType.ExcelWorksheet, 
    System.Drawing.Image.FromFile(@"Images\Excel.ico"), new PointF(0f, 0f));
// Add the second OLE object to the group.
groupItems.AddOleObjectAsIcon(@"D:\PowerPointPresentation.pptx", OleObjectType.PowerPointPresentation,
    System.Drawing.Image.FromFile(@"Images\PowerPoint.ico"), new PointF(1.5f, 0f));
See Also