content_type property

SaveOutputParameters.content_type property

Returns the Content-Type string (Internet Media Type) that identifies the type of the saved document.

@property
def content_type(self) -> str:
    ...

Examples

Shows how to access output parameters of a document’s save operation.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.writeln('Hello world!')
# After we save a document, we can access the Internet Media Type (MIME type) of the newly created output document.
parameters = doc.save(file_name=ARTIFACTS_DIR + 'Document.SaveOutputParameters.doc')
self.assertEqual('application/msword', parameters.content_type)
# This property changes depending on the save format.
parameters = doc.save(file_name=ARTIFACTS_DIR + 'Document.SaveOutputParameters.pdf')
self.assertEqual('application/pdf', parameters.content_type)

See Also