OO-Snippets: Open Password protected file and displaying Pwd-Dialog

Commons

Keywordspassword proctected, open file, password dialog
LanguageJava
ApplicationOffice
AuthorsTom Schindl (initial)
Supported Versions
Supported OS
Question How do I open a password protected OO-Document and display the Password dialog
Answer

You have to provide an InteractionHandler, which shows the password dialog. You can create such handler by your own .. or use our global one, which implements every interaction we know. (Andreas Schlüns <andreas.schluens@sun.com>)

Code-Snippet-Listing (snippet-source)

XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface( XInteractionHandler.class, xSMGR.createInstance("com.sun.star.task.InteractionHandler"));

PropertyValue[] lArgs    = new PropertyValue[1];
lArgs[0] = new PropertyValue();
lArgs[0].Name  = "InteractionHandler";
lArgs[0].Value = xHandler;

xDoc = xDesktop.loadComponentFromURL(sURL, sTarget, nSearchFlags, lArgs);

Changelog

DateUserModification
2004-06-11tomsontomIntial version

and