Skip to main content
All docs
V24.1

OleFormat.OlePackage Property

Returns properties for the OLE object of the Package type.

Namespace: DevExpress.XtraRichEdit.API.Native

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

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

Declaration

OlePackage OlePackage { get; }

Property Value

Type Description
OlePackage

An object that contains OLE Package properties.

Remarks

OLE Package is a legacy way to embed arbitrary data into a document when an OLE handler is missing or unknown.

Use the OleFormat.OlePackage property to obtain or specify properties associated with an OLE package (its file name and display name). The OleFormat.ProgId property allows you to check whether an existing OLE object is a Package.

Example

The following example embeds an OLE package in the document. The OLE package contains compressed files in the zip archive format.

Activate an OLE Package

using DevExpress.XtraRichEdit.API.Native;
using System.IO;
using System.Drawing;
// ...

Document document = wordProcessor.Document;
// Embed a zip archive in the document.
// Display the OLE object as an icon.
using (Stream zipStream = File.Open(@"D:\Attachment.zip", FileMode.Open))
{
    Shape oleObject = document.Shapes.InsertOleObjectAsIcon(document.Range.Start, zipStream,
        OleObjectType.Package, DocumentImageSource.FromFile(@"Images\Package.ico"));
    oleObject.OleFormat.OlePackage.FileName = "D:\\Attachment.zip";
    oleObject.OleFormat.OlePackage.DisplayName = "DocumentAttachment.zip";
     // Specify the object position on the page.
    oleObject.RelativeHorizontalPosition = ShapeRelativeHorizontalPosition.Column;
    oleObject.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Paragraph;
    oleObject.Offset = new PointF(0, 0);
}
See Also