get_raw_data method

get_raw_data()

Gets OLE object raw data.

def get_raw_data(self):
    ...

Examples

Shows how to access the raw data of an embedded OLE object.

doc = aw.Document(file_name=MY_DIR + 'OLE objects.docx')
for shape in doc.get_child_nodes(aw.NodeType.SHAPE, True):
    shape = shape.as_shape()
    ole_format = shape.ole_format
    if ole_format != None:
        print(f"This is {('a linked' if ole_format.is_link else 'an embedded')} object")
        ole_raw_data = ole_format.get_raw_data()
        self.assertEqual(24576, len(ole_raw_data))

See Also