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?