BuiltInDocumentProperties class

BuiltInDocumentProperties class

A collection of built-in document properties. To learn more, visit the Work with Document Properties documentation article.

Remarks

Provides access to DocumentProperty objects by their names (using an indexer) and via a set of typed properties that return values of appropriate types.

The names of the properties are case-insensitive.

The properties in the collection are sorted alphabetically by name.

Inheritance: BuiltInDocumentPropertiesDocumentPropertyCollection

Indexers

NameDescription
__getitem__(index)

Properties

NameDescription
authorGets or sets the name of the document’s author.
bytesRepresents an estimate of the number of bytes in the document.
categoryGets or sets the category of the document.
charactersRepresents an estimate of the number of characters in the document.
characters_with_spacesRepresents an estimate of the number of characters (including spaces) in the document.
commentsGets or sets the document comments.
companyGets or sets the company property.
content_statusGets or sets the content status of the document.
content_typeGets or sets the content type of the document.
countGets number of items in the collection.
(Inherited from DocumentPropertyCollection)
created_timeGets or sets date of the document creation in UTC.
heading_pairsSpecifies document headings and their names.
hyperlink_baseSpecifies the base string used for evaluating relative hyperlinks in this document.
hyperlinks_changedIndicates whether hyperlinks in a document were changed.
keywordsGets or sets the document keywords.
last_printedGets or sets the date when the document was last printed in UTC.
last_saved_byGets or sets the name of the last author.
last_saved_timeGets or sets the time of the last save in UTC.
linesRepresents an estimate of the number of lines in the document.
links_up_to_dateIndicates whether hyperlinks in a document are up-to-date.
managerGets or sets the manager property.
name_of_applicationGets or sets the name of the application.
pagesRepresents an estimate of the number of pages in the document.
paragraphsRepresents an estimate of the number of paragraphs in the document.
revision_numberGets or sets the document revision number.
scale_cropIndicates whether document thumbnail is cropped or scaled to fit the display.
securitySpecifies the security level of a document as a numeric value.
shared_documentIndicates whether the document is a shared document.
subjectGets or sets the subject of the document.
templateGets or sets the informational name of the document template.
thumbnailGets or sets the thumbnail of the document.
titleGets or sets the title of the document.
titles_of_partsEach string in the array specifies the name of a part in the document.
total_editing_timeGets or sets the total editing time in minutes.
versionRepresents the version number of the application that created the document.
wordsRepresents an estimate of the number of words in the document.

Methods

NameDescription
clear()Removes all properties from the collection.
(Inherited from DocumentPropertyCollection)
contains(name)Returns True if a property with the specified name exists in the collection.
(Inherited from DocumentPropertyCollection)
get_by_name(name)Returns a DocumentProperty object by the name of the property.
(Inherited from DocumentPropertyCollection)
index_of(name)Gets the index of a property by name.
(Inherited from DocumentPropertyCollection)
remove(name)Removes a property with the specified name from the collection.
(Inherited from DocumentPropertyCollection)
remove_at(index)Removes a property at the specified index.
(Inherited from DocumentPropertyCollection)

Examples

Shows how to work with built-in document properties.

doc = aw.Document(MY_DIR + 'Properties.docx')
# The "Document" object contains some of its metadata in its members.
print(f'Document filename:\n\t "{doc.original_file_name}"')
# The document also stores metadata in its built-in properties.
# Each built-in property is a member of the document's "BuiltInDocumentProperties" object.
print('Built-in Properties:')
for doc_property in doc.built_in_document_properties:
    print(doc_property.name)
    print(f'\tType:\t{doc_property.type}')
    # Some properties may store multiple values.
    if isinstance(doc_property.value, list):
        for value in doc_property.value:
            print(f'\tValue:\t"{value}"')
    else:
        print(f'\tValue:\t"{doc_property.value}"')

See Also