Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Most examples in the devguide are in Java. How do I translate them to python code ?

0
Posted

Most examples in the devguide are in Java. How do I translate them to python code ?

0

Most sample code you find there is written in Java. It is easy to translate Java code to python,when you know the following differences: In python you don’t need queryInterface. E.g. Java code like oInterface = (XInterface) oMSF.createInstance( “com.sun.star.frame.Desktop” ); oCLoader = ( XComponentLoader ) UnoRuntime.queryInterface( XComponentLoader.class, oInterface ); PropertyValue [] szEmptyArgs = new PropertyValue [0]; aDoc = oCLoader.loadComponentFromURL( “private:factory/swriter” , “_blank”, 0, szEmptyArgs ); becomes in python simply oCLoader = oMSF.createInstance( “com.sun.star.frame.Desktop” ) aDoc = oCLoader.loadComponentFromURL( “private:factory/swriter”, “_blank”, 0, () ) You don’t need this intermediate oInterface variable anymore. So the python code simplifies the example a lot, with a little training, you shouldn’t have too many problems to translating Java to python code.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123