always_compress_metafiles property

DocSaveOptions.always_compress_metafiles property

When False, small metafiles are not compressed for performance reason. Default value is True, all metafiles are compressed regardless of its size.

@property
def always_compress_metafiles(self) -> bool:
    ...

@always_compress_metafiles.setter
def always_compress_metafiles(self, value: bool):
    ...

Examples

Shows how to change metafiles compression in a document while saving.

# Open a document that contains a Microsoft Equation 3.0 formula.
doc = aw.Document(file_name=MY_DIR + 'Microsoft equation object.docx')
# When we save a document, smaller metafiles are not compressed for performance reasons.
# We can set a flag in a SaveOptions object to compress every metafile when saving.
# Some editors such as LibreOffice cannot read uncompressed metafiles.
save_options = aw.saving.DocSaveOptions()
save_options.always_compress_metafiles = compress_all_metafiles
doc.save(file_name=ARTIFACTS_DIR + 'DocSaveOptions.AlwaysCompressMetafiles.docx', save_options=save_options)

See Also