# В этом примере функция open_args() открывает файл new1.odt с установленным паролем 1234 
import uno
from com.sun.star.beans import PropertyValue


CTX = uno.getComponentContext()
SM = CTX.getServiceManager()

def create_instance(name, with_context=False):
    if with_context:
        instance = SM.createInstanceWithContext(name, CTX)
    else:
        instance = SM.createInstance(name)
    return instance
    


def open_args():
    path = uno.systemPathToFileUrl('D:/new1.odt')
    desktop = create_instance('com.sun.star.frame.Desktop', True)
    args = (PropertyValue(Name='Password', Value='1234'),)
    doc = desktop.loadComponentFromURL(path, '_default', 0, args)
    return