Embedded document name

Last post 08-30-2010, 12:53 AM by Salman Shakeel. 9 replies.
Sort Posts: Previous Next
  •  08-25-2010, 4:11 AM 255499

    Embedded document name .NET

    I have been evaluating the Aspose.Cells, Aspose.Slides and Aspose.Words APIs with a view of extracting embedded documents from MSWord, Excel and PowerPoint documents. Altough the extracting of embedded file from these docuements is quite straight forward and impressive, I'm struggling to maintain the origincal file names of the documents.

    I'm aware that at certian times this information is not saved while embeddeding the document, but its is emperitive that I get as much a success rate as I can. Is there a workaround I can do to extract this information for the OleObject / OleObjectFrame?

    Thanks. 

      

     
  •  08-25-2010, 1:44 PM 255634 in reply to 255499

    Re: Embedded document name

    Hi,

    I am a representative of Aspose.Cells, I think you may use OleObject.SourceFullName attribute to get the source file name for your requirement.

    Thank you.



    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  08-26-2010, 12:36 AM 255682 in reply to 255634

    Re: Embedded document name

    Thanks Amjad for the reply. I'm already using this property for Aspose.Cells and Aspose.Word but hardly ever get anything back. For Aspose.Slides, there is no such property since we're us  OleObject Frame. For Aspose.Slides, we're using OleObjectFrame.AlternativeText to extract file name, but again its hardly ever populated.

    As I mentioned earlier, it is imperitive that we get the file names in most cases and now that we know that there is no certain way of getting them through the properties exposed by the libraries, is there a workaround? Perhaps reading directly from the file stream.

    I know it can be done, hence the persistent questions. 

    Thanks again.

     
  •  08-26-2010, 1:02 AM 255690 in reply to 255682

    Re: Embedded document name

    Hi,

    "I'm already using this property for Aspose.Cells and Aspose.Word but hardly ever get anything back"

    Could you give us your template Excel file and sample code (you are using) here to check the issue regarding Aspose.Cells component.

    Regarding Aspose.Slides, one of our Aspose.Slides team member would help you soon.

    Thank you.

    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  08-26-2010, 2:43 AM 255708 in reply to 255690

    Re: Embedded document name

    Attachment: Present (inaccessible)
    Attached is the sample code and sample files for which I have not been able to extract the embedded document names.
     
  •  08-26-2010, 9:33 AM 255778 in reply to 255708

    Re: Embedded document name

    Hi there,

    Thanks for attaching your documents here for testing.

    When an object is embedded inside a document (for MS Word at least) the filename is actually not stored. The SourceFullName property only applies to when a document is linked, and that property contains the path of where to find the document it is linked too. In Aspose.Words, the OleFormat.IsLink property is actually just testing if the SourceFileName property is empty or not, as it appears the presense of any set path is what defines an object to be linked or not. On the other hand, embedded objects store no file name so with all of the embedded objects you have encountered, this field has been empty.

    You will also notice that the embedded objects in your documents display the short file name below the icon. This is not stored as text, but is actually an image in EMF format which is saved by MS Word with the object itself (and which can also be accessed and extracted using the ImageData property of the Shape class)

    I believe the above applies to the other Aspose products as well, although they will need to clarify that. My suggestion for you to be able to extract original file names with an embedded object is to simply store them in the Alternative Text or ScreenTip of the object in MS Word (this can then easily be extracted from the object in code by using the appropriate property), or you may even want to consider running some OCR on the image and extracting the file name from there.

    If you have any further queries, please feel free to ask.

    Thanks,


    Adam Skelton
    Programming Writer
    Aspose Auckland Team
     
  •  08-27-2010, 1:04 AM 255893 in reply to 255778

    Re: Embedded document name

    Hi,

    Thanks for sample project and files.

    I have logged an issue regarding Aspose.Cells component into our issue tracking system with an id: CELLSNET-19631. We will look into it and get back to you soon.

    Thank you.

    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  08-27-2010, 5:44 AM 255934 in reply to 255778

    Re: Embedded document name

    That was a great tip to use thee wmf or icon file.

    I've managed to extract the name of the file (if present) from the byte stream provided by the OleObject.ImageData for Excel and ImageData.ImageBytes for MSWord. No saving the icon file or OCR required.

    One help I require from the Aspose.Slides team is where to get access to a similar Image Data stream when dealing with PPT.  

    Thanks again.

     
  •  08-27-2010, 6:31 PM 256026 in reply to 255934

    Re: Embedded document name

    Hi there,

    Ah that's great result! I thoroughly inspected the OleObject's bytes, but didn't even think to actually take a look into the bytes of the icon as well. It seems when the embedded object is set to display as an icon, it stores the icon image along with a caption which by default the filename of the embedded document. Seems no such luck when the object is embedded as the proper content though. In any case I'm glad you found what you are looking for. I have logged a new feature request to be able to properly extract the caption (filename) from embedded objects with an OleIcon in Aspose.Words. We will keep you informed of any developments. 

    Thanks,


    Adam Skelton
    Programming Writer
    Aspose Auckland Team
     
  •  08-30-2010, 12:53 AM 256095 in reply to 255934

    Re: Embedded document name

    Hi Baroon,

    If OleObject.IsLink is false, the SourceFullName is invalid.
    You will also notice that the embedded objects in your documents display the short file name below the icon. This is not stored as text, but is actually an image in EMF format which is saved by MS Excel.
    If you want to make source full name valid, please confirm that “Link to file” is checked (Tools -> insert->Create from file (Tab)).

    Thanks,

    Sincere Regards,

    Salman Shakeel
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
View as RSS news feed in XML