file_name property
OlePackage.file_name property
Gets or sets OLE Package file name.
@property
def file_name(self) -> str:
...
@file_name.setter
def file_name(self, value: str):
...
Examples
Shows how insert an OLE object into a document.
doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
# OLE objects allow us to open other files in the local file system using another installed application
# in our operating system by double-clicking on the shape that contains the OLE object in the document body.
# In this case, our external file will be a ZIP archive.
zip_file_bytes = system_helper.io.File.read_all_bytes(DATABASE_DIR + 'cat001.zip')
with io.BytesIO(zip_file_bytes) as stream:
shape = builder.insert_ole_object(stream=stream, prog_id='Package', as_icon=True, presentation=None)
shape.ole_format.ole_package.file_name = 'Package file name.zip'
shape.ole_format.ole_package.display_name = 'Package display name.zip'
doc.save(file_name=ARTIFACTS_DIR + 'Shape.InsertOlePackage.docx')
See Also
- module aspose.words.drawing
- class OlePackage