Extract OleObject

Using the .NET version is it possible to extract an oleobject from a specific cell of a worksheet or can you only obtain a collection of oleobjects from a worksheet? I need to extract several embeded objects and there is not way to easily distinguish them apart from one another other than their location. Also, had a quick question about the oleobject. In which version were additional members added like filetype?

Thanks

Hi,

Well, you need to get the Ole Objects from a worksheet, iterate each Ole Object (by its index position), now extract its position and other coordinates using OleObject.Left/LeftCM, OleObject.Top/TopCM and other properties etc. to distinguish them for your need.

For additional filetype support, which file format type you are talking about? I have attached our latest version/fix in which the maximum ole file types are supported(Doc,XLS,PDF,PPT,MSEquation,Unknown), so, you may use it.

Thank you.

Thanks for the response. I was able to upgrade to version 4.4.0.5 which contained the necessary properties. One other question. I know about the FileType enum on OleObject, but is there anyway to determine whether the oleobject is a 97-2003 or 2007 format for word, excel and powerpoint?

Thanks

Hi,

Thank you for considering Aspose.

I think the only way to achieve your desired goal is to use FileType enum. You can easily check for the file extensions to determine whether your oleobject is of format 97-2003 or 2007. Please see the following documentation topic in this regard,

Managing OLE Objects (.NET)
Managing OLE Objects (Java)

Thank You & Best Regards,

Hi,

Thank you for considering Aspose.

Also, to check the OleObject file type to be of Office 2007 file format (or other formats too), you may use some manual code by checking the source file extension as under,

OleObject oleObject = workbook.Worksheets[0].OleObjects[0];

string sourceFullName = oleObject.SourceFullName;

if (sourceFullName != null && sourceFullName != "")

{

string extension = Path.GetExtension(sourceFullName);

switch (extension)

{

case ".xlsx":

case ".xlsm":

case ".xltx":

case ".xltm":

case ".docx":

case ".pptx":

case ".sldx":

//2007

break;

}

}

Thank You & Best Regards,