OleObjectFrame

Inheritance: java.lang.Object, com.aspose.slides.Shape, com.aspose.slides.GraphicalObject

All Implemented Interfaces: com.aspose.slides.IOleObjectFrame

public class OleObjectFrame extends GraphicalObject implements IOleObjectFrame

Represents an OLE object on a slide.


The following example shows how to accessing OLE Object frames.
 
 // Loads the PPTX to a presentation object
 Presentation pres = new Presentation("AccessingOLEObjectFrame.pptx");
 try {
     // Accesses the first slide
     ISlide sld = pres.getSlides().get_Item(0);
     // Casts the shape to OleObjectFrame
     OleObjectFrame oleObjectFrame = (OleObjectFrame) sld.getShapes().get_Item(0);
     // Reads the OLE Object and writes it to disk
     if (oleObjectFrame != null) {
         // Gets embedded file data
         byte[] data = oleObjectFrame.getEmbeddedData().getEmbeddedFileData();
         // Gets embedded file extention
         String fileExtension = oleObjectFrame.getEmbeddedData().getEmbeddedFileExtension();
         // Creates a path to save the extracted file
         String extractedPath = "excelFromOLE_out" + fileExtension;
         // Saves extracted data
         Files.write(Paths.get(extractedPath), data);
     }
 } catch(IOException e) {
 } finally {
     if (pres != null) pres.dispose();
 }

Methods

MethodDescription
getSubstitutePictureFormat()Returns OleObject image fill properties object.
getSubstitutePictureTitle()Returns or sets the title for OleObject icon.
setSubstitutePictureTitle(String value)Returns or sets the title for OleObject icon.
getObjectName()Returns or sets the name of an object.
setObjectName(String value)Returns or sets the name of an object.
getObjectProgId()Returns the ProgID of an object.
setObjectProgId(String value)Returns the ProgID of an object.
getLinkFileName()Returns the full path to a linked file.
getLinkPathLong()Returns the full path to a linked file.
setLinkPathLong(String value)Returns the full path to a linked file.
getLinkPathRelative()Returns the relative path to a linked file if present, otherwise returns an empty string.
getEmbeddedFileLabel()Returns the file name of embedded OLE object
getEmbeddedFileName()Returns the path of embedded OLE object
getEmbeddedData()Gets or sets information about OLE embedded data.
setEmbeddedData(IOleEmbeddedDataInfo embeddedData)Sets information about OLE embedded data.
isObjectIcon()Determines whether an object is visible as icon.
setObjectIcon(boolean value)Determines whether an object is visible as icon.
isObjectLink()Determines whether an object is linked to external file.
getUpdateAutomatic()Determines if the linked embedded object is automatically updated when the presentation is opened or printed.
setUpdateAutomatic(boolean value)Determines if the linked embedded object is automatically updated when the presentation is opened or printed.

getSubstitutePictureFormat()

public final IPictureFillFormat getSubstitutePictureFormat()

Returns OleObject image fill properties object. Read-only IPictureFillFormat.

Returns: IPictureFillFormat

getSubstitutePictureTitle()

public final String getSubstitutePictureTitle()

Returns or sets the title for OleObject icon. Read/write String.


When IsObjectIcon == false this value is ignored. The string can be truncated according to the size of the Ole icon.

Returns: java.lang.String

setSubstitutePictureTitle(String value)

public final void setSubstitutePictureTitle(String value)

Returns or sets the title for OleObject icon. Read/write String.


When IsObjectIcon == false this value is ignored. The string can be truncated according to the size of the Ole icon.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getObjectName()

public final String getObjectName()

Returns or sets the name of an object. Read/write String.

Returns: java.lang.String

setObjectName(String value)

public final void setObjectName(String value)

Returns or sets the name of an object. Read/write String.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getObjectProgId()

public final String getObjectProgId()

Returns the ProgID of an object. Read only String.

Returns: java.lang.String

setObjectProgId(String value)

public final void setObjectProgId(String value)

Returns the ProgID of an object. Read only String.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getLinkFileName()

public final String getLinkFileName()

Returns the full path to a linked file. Short file name will be used. Read-only String.

Returns: java.lang.String

getLinkPathLong()

public final String getLinkPathLong()

Returns the full path to a linked file. Long file name will be used. Read/write String.

Returns: java.lang.String

setLinkPathLong(String value)

public final void setLinkPathLong(String value)

Returns the full path to a linked file. Long file name will be used. Read/write String.

Parameters:

ParameterTypeDescription
valuejava.lang.String

getLinkPathRelative()

public final String getLinkPathRelative()

Returns the relative path to a linked file if present, otherwise returns an empty string. Readonly String.


Presentation presentation = new Presentation("demo.ppt");
 try {
     IOleObjectFrame oleFrame = (IOleObjectFrame)presentation.getSlides().get_Item(0).getShapes().get_Item(0);
     if (oleFrame != null)
     {
         System.out.println("The relative path: " + oleFrame.getLinkPathRelative());
     }
 } finally {
     if (presentation != null) presentation.dispose();
 }

In the Ppt presentations, some Ole object links may have a relative representation.

Returns: java.lang.String

getEmbeddedFileLabel()

public final String getEmbeddedFileLabel()

Returns the file name of embedded OLE object

Returns: java.lang.String

getEmbeddedFileName()

public final String getEmbeddedFileName()

Returns the path of embedded OLE object

Returns: java.lang.String

getEmbeddedData()

public final IOleEmbeddedDataInfo getEmbeddedData()

Gets or sets information about OLE embedded data. Read/write IOleEmbeddedDataInfo.

Returns: IOleEmbeddedDataInfo

setEmbeddedData(IOleEmbeddedDataInfo embeddedData)

public final void setEmbeddedData(IOleEmbeddedDataInfo embeddedData)

Sets information about OLE embedded data.


Presentation pres = new Presentation("SomePresentation.pptx");
 try {
     OleObjectFrame oof = (OleObjectFrame) pres.getSlides().get_Item(0).getShapes().get_Item(0);
     if (oof != null)
     {
         IOleEmbeddedDataInfo newData = new OleEmbeddedDataInfo(Files.readAllBytes(Paths.get("Picture.png")), "png");
         oof.setEmbeddedData(newData);
     }
 } catch (IOException e) {
 } finally {
     if (pres != null) pres.dispose();
 }

Parameters:

ParameterTypeDescription
embeddedDataIOleEmbeddedDataInfoEmbedded data IOleEmbeddedDataInfo

This method changes the properties of the object to reflect the new data and sets the IsObjectLink flag to false, indicating that the OLE object is embedded. |

isObjectIcon()

public final boolean isObjectIcon()

Determines whether an object is visible as icon. Read/write boolean .

Returns: boolean

setObjectIcon(boolean value)

public final void setObjectIcon(boolean value)

Determines whether an object is visible as icon. Read/write boolean .

Parameters:

ParameterTypeDescription
valueboolean
public final boolean isObjectLink()

Determines whether an object is linked to external file. Read-only boolean .

Returns: boolean

getUpdateAutomatic()

public final boolean getUpdateAutomatic()

Determines if the linked embedded object is automatically updated when the presentation is opened or printed. Read/write boolean .

Returns: boolean

setUpdateAutomatic(boolean value)

public final void setUpdateAutomatic(boolean value)

Determines if the linked embedded object is automatically updated when the presentation is opened or printed. Read/write boolean .

Parameters:

ParameterTypeDescription
valueboolean