Hi everybody,
i'm asked to develop an extension for Calc in Beanshell.
The beanshell code import Java classes, and one of them had to use File.getPath function. My problem goes from the result of this function. The string is like : ${$SYSBINDIR/bootstrap.ini::UserInstallation}... And Java cannot work whith a such path.
So my question is :
Is there a way to convert ${$SYSBINDIR/bootstrap.ini::UserInstallation} into a windows path ?
thanks for answering
Beanshell + Java : file path problem
Re: Beanshell + Java : file path problem
I'm not shure but this looks promising:
http://api.openoffice.org/docs/common/r ... ander.html
http://udk.openoffice.org/common/man/co ... .html#misc
http://api.openoffice.org/docs/common/r ... ander.html
http://udk.openoffice.org/common/man/co ... .html#misc
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Beanshell + Java : file path problem
Your information explain the form of my path...but it seems that i need get a filepath without using this Bootstrap system.
Thanks for your answer
Thanks for your answer
Re: Beanshell + Java : file path problem
you do not have to use the bootstrap mechanism to use the services mentioned in the links above. Try this beanshell script ...
Code: Select all
sInput = "${$SYSBINDIR/bootstrap.ini::UserInstallation}";
oMacroExpander = XSCRIPTCONTEXT.getComponentContext().getValueByName("/singletons/com.sun.star.util.theMacroExpander");
sOutput = oMacroExpander.expandMacros(sInput);
javax.swing.JOptionPane.showMessageDialog(null, sOutput, sInput, javax.swing.JOptionPane.WARNING_MESSAGE);
return 0;