We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word Embedded Attachment Extraction Name is empty

When I try to save the OLE embedded object, I have to hard code the names since I am not able to extract the file name because suggested file name is coming empty string. Here is a sample code and the file I’m trying to do the extraction

# Extract the page level data
for page in range(doc.page_count):

    extracted_page = doc.extract_pages(page, 1)

    for idx, shape in enumerate(extracted_page.get_child_nodes(node_type=aw.NodeType.SHAPE, is_deep=True)):

        # saving embedded objects

        ole_format = shape.as_shape().ole_format

        if ole_format:

            object_name = ole_format.suggested_file_name

            object_ext = ole_format.suggested_extension

            #if the embedded object name returned is empty string assign a name

            if object_name == '':

                object_name = f"Embedded_File{idx+1}"

            attactment_name = object_name + object_ext

            ole_format.save(attachment_name)

Is there a way I can get the original name of the embedded Test1.docx (84.0 KB)
attachment?

@Devanandan.Subbarayalu Unfortunately, at the moment, getting the name of the embedded Docx object is not implemented. I have logged this task as WORDSNET-24632. We will keep you informed and let you know once it is resolved.