LoadOptions class

LoadOptions class

Allows a developer to specify additional options (such as a password) when loading a file.

Learn more

The LoadOptions type exposes the following members:

Constructors

Constructor Description
init Initializes a new instance of the LoadOptions class.
init Initializes a new instance of the LoadOptions class.

Properties

Property Description
file_format The exact type of the file that is to be loaded.
password The password for opening an encrypted document.

Example

from groupdocs.metadata import Metadata
from groupdocs.metadata.options import LoadOptions

def load_password_protected_document():
    # Specify the password
    load_options = LoadOptions()
    load_options.password = "123"

    with Metadata("protected.docx", load_options) as metadata:
        print(f"Opened protected {metadata.file_format} document")
from groupdocs.metadata import Metadata
from groupdocs.metadata.common import FileFormat
from groupdocs.metadata.options import LoadOptions

def loading_file_of_specific_format():
    load_options = LoadOptions(FileFormat.SPREADSHEET)

    with Metadata("input.xlsx", load_options) as metadata:
        root = metadata.get_root_package()
        print(f"Author: {root.document_properties.author}")

See Also