All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ShapeCollection.InsertOleObjectAsIcon(DocumentPosition, Stream, String, Image) Method

Inserts an OLE object that stores data from the specified file. The object is displayed in the document as an icon.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

Shape InsertOleObjectAsIcon(
    DocumentPosition pos,
    Stream stream,
    string progId,
    Image icon
)
Function InsertOleObjectAsIcon(
    pos As DocumentPosition,
    stream As Stream,
    progId As String,
    icon As Image
) As Shape

Parameters

Name Type Description
pos DocumentPosition

The position of the object's anchor.

stream Stream

A stream that contains data to embed in the document.

progId String

Embedded content type. You can use constant fields of the OleObjectType class to set this value.

icon Image

The icon for the OLE object.

Returns

Type Description
Shape

The OLE object added to the document.

Remarks

The following example embeds an OLE object in the document:

Document document = wordProcessor.Document;
// Embed data from an Excel worksheet in the document.
// The OLE object is displayed in the document as an icon.
using (Stream excelStream = File.Open(@"D:\ExcelWorkbook.xlsx", FileMode.Open))
{
    Shape oleObject = document.Shapes.InsertOleObjectAsIcon(document.CreatePosition(1780), excelStream,
      OleObjectType.ExcelWorksheet, System.Drawing.Image.FromFile(@"Images\Excel.ico"));
    // Specify the object position on the page.
    oleObject.RelativeHorizontalPosition = ShapeRelativeHorizontalPosition.Column;
    oleObject.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Paragraph;
    oleObject.Offset = new PointF(0, 0);
    // Specify how text wraps around the object. 
    oleObject.TextWrapping = TextWrappingType.TopAndBottom;
}
See Also