Back to Devexpress

OleFormat.ChangeRepresentation(OleObjectRepresentationType, DocumentImageSource) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-oleformat-dot-changerepresentation-x28-oleobjectrepresentationtype-documentimagesource-x29.md

latest3.1 KB
Original Source

OleFormat.ChangeRepresentation(OleObjectRepresentationType, DocumentImageSource) Method

Changes the display style for the OLE object.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void ChangeRepresentation(
    OleObjectRepresentationType drawAspect,
    DocumentImageSource presentation
)
vb
Sub ChangeRepresentation(
    drawAspect As OleObjectRepresentationType,
    presentation As DocumentImageSource
)

Parameters

NameTypeDescription
drawAspectOleObjectRepresentationType

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

| | presentation | DocumentImageSource |

An object used to load 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:

csharp
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, DocumentImageSource.FromFile(@"Images\Spreadsheet.png"));

// Display the OLE object as an icon.
oleObject.OleFormat.ChangeRepresentation(OleObjectRepresentationType.Icon, 
    DocumentImageSource.FromFile(@"Images\Excel.ico"));
vb
Dim document As Document = wordProcessor.Document
' Insert an OLE object. Link it to an Excel worksheet.
' The OLE object is displayed in the document as an image.
Dim oleObject As Shape = document.Shapes.InsertOleObject(document.CreatePosition(1780), "D:\ExcelWorkbook.xlsx", _ 
OleObjectType.ExcelWorksheet, DocumentImageSource.FromFile("Images\Spreadsheet.png"))

' Display the OLE object as an icon.
oleObject.OleFormat.ChangeRepresentation(OleObjectRepresentationType.Icon, DocumentImageSource.FromFile("Images\Excel.ico"))

See Also

OleFormat Interface

OleFormat Members

DevExpress.XtraRichEdit.API.Native Namespace