Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

OleFormat.ChangeRepresentation(OleObjectRepresentationType, Image) Method

Changes the display style for the OLE object.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

[Browsable(false)]
void ChangeRepresentation(
    OleObjectRepresentationType drawAspect,
    Image presentation
)

#Parameters

Name Type Description
drawAspect OleObjectRepresentationType

An enumeration member that specifies how the OLE object should be displayed in the document (as an image or an icon).

presentation Image

A new image or icon for the OLE object.

#Remarks

The following example shows how to use an icon instead of an image to display an OLE object in the document:

Document document = wordProcessor.Document;
// Insert an OLE object. Link it to an Excel worksheet.
// The OLE object is displayed in the document as an image.
Shape oleObject = document.Shapes.InsertOleObject(document.CreatePosition(1780), @"D:\ExcelWorkbook.xlsx",
    OleObjectType.ExcelWorksheet, System.Drawing.Image.FromFile(@"Images\Spreadsheet.png"));

// Display the OLE object as an icon.
oleObject.OleFormat.ChangeRepresentation(OleObjectRepresentationType.Icon, 
    System.Drawing.Image.FromFile(@"Images\Excel.ico"));
See Also