OleObject Class

Represents an object which is inserted into the MPP file.
Inheritance Hierarchy
SystemObject
  Aspose.TasksOleObject

Namespace:  Aspose.Tasks
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 21.10
Syntax
public class OleObject

The OleObject type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleApplicationName
Gets the application name to open the embedded object with.
Public propertyCode exampleContent
Gets the embedded file's data; null if no data was embedded.
Public propertyCode exampleDisplayAsIcon
Gets a flag indicating that OLE object should be shown either as an icon or as its regular picture.
Public propertyCode exampleFileFormat
Gets the file format of the embedded object.
Public propertyCode exampleFullPath
Gets the full path of the inserted object.
Public propertyCode exampleId
Gets the object id.
Public propertyCode exampleLabel
Gets the label of the inserted object.
Public propertyCode exampleLinked
Gets a value indicating whether the project file contains only a link to the actual data stored at the link source.
Public propertyCode exampleName
Gets the name of the instance of the OleObject class.
Public propertyCode exampleTemporaryFile
Gets the path to the temporary file of the inserted object.
Public propertyCode exampleView
Gets the instance of the View class the inserted object belongs to.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Examples
Shows how to read info about OLE objects.
[Test]
public void WorkWithOleObject()
{
    var images = new Project(DataDir + "TaskImage2010.mpp");
    List<OleObject> oleObjects = images.OleObjects.ToList();

    Console.WriteLine("Ole Objects Count: " + oleObjects.Count);
    foreach (var oleObject in oleObjects)
    {
        Console.WriteLine(" Id: " + oleObject.Id);
        Console.WriteLine(" Name: " + oleObject.Name);
        Console.WriteLine(" DisplayAsIcon: " + oleObject.DisplayAsIcon);
        Console.WriteLine(" Application Name: " + oleObject.ApplicationName);
        Console.WriteLine(" File Format: " + oleObject.FileFormat);
        Console.WriteLine(" Label: " + oleObject.Label);
        Console.WriteLine(" Full Path: " + oleObject.FullPath);
        Console.WriteLine(" Is Linked: " + oleObject.Linked);
        Console.WriteLine(" View Name: " + oleObject.View.Name);
        Console.WriteLine(" Content (first 10 bytes): " + this.Get10Bytes(oleObject));
    }
}

private string Get10Bytes(OleObject oleObject)
{
    byte[] bytes = oleObject.Content;
    var chunk = new byte[10];
    Array.Copy(bytes, chunk, 10);
    var builder = new StringBuilder();
    foreach (var b in chunk)
    {
        builder.Append(b + ", ");
    }

    builder.Remove(builder.Length - 3, 1);
    return builder.ToString();
}
See Also