Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to translate to .NET ?

48 views
Skip to first unread message

ejs

unread,
Jan 23, 2011, 5:12:26 PM1/23/11
to
Dear All,

the excerpt in C# is:
...
unoidl.com.sun.star.uno.XComponentContext localContext =
uno.util.Bootstrap.bootstrap();

unoidl.com.sun.star.lang.XMultiServiceFactory multiServiceFactory =
(unoidl.com.sun.star.lang.XMultiServiceFactory)
localContext.getServiceManager();

...

what it will be like in MatLAB? The deadlock is class definition of
variable. Writing the sentences as:

localContext = uno.util.Bootstrap.bootstrap();
multiServiceFactory = localContext.getServiceManager();

fails, approximatelly saying 'no such method' (sorry, but the
NET.addAssembly() code is not working in x64 arch, so i can't reproduce
it right now).

--
ejs

Fazil_Peermohammed

unread,
Jan 26, 2011, 11:57:42 AM1/26/11
to
Could you give details on why NET.addAssembly is not working in x64? What is
the error message?

-Fazil


"ejs" <e...@seniejitrakai.net> wrote in message
news:4d3ca7ce$0$23756$1472...@news.sunsite.dk...

ejs

unread,
Jan 27, 2011, 7:21:30 AM1/27/11
to
2011.01.24 00:12, ejs rašė:
> Dear All,
>
> the excerpt in C# is:
> ...
> unoidl.com.sun.star.uno.XComponentContext localContext =
> uno.util.Bootstrap.bootstrap();

What i'm trying to achieve is controlling OpenOffice.org from MatLAB, so
the .NET code is running from MatLAB side.
I hope to write 'odswrite' ;)

--
ejs

ejs

unread,
Jan 28, 2011, 8:44:36 AM1/28/11
to
2011.01.26 18:57, Fazil_Peermohammed rašė:
> Could you give details on why NET.addAssembly is not working in x64?
> What is the error message?

??? Message: Could not load file or assembly 'cli_cppuhelper,
Version=1.0.21.0,
Culture=neutral, PublicKeyToken=ce2cb7e279207b9e' or one of its
dependencies. The
system cannot find the file specified.
Source: mscorlib
HelpLink:

The file exists, test program in C# from
http://ejs.seniejitrakai.net/2011/01/23/openoffice-org-x64-and-net-interface/
( http://ejs.seniejitrakai.net/njufsams/OpenOfficeTestApp.exe ) works
fine both in x32 and in x64 architectures.
The assembly is targeted to x32 architecture, but it's not a problem for
standalone application.


the MatLAB code:

if ~exist('OOorgBase')
str = computer;
if (strcmpi('pcwin',str(1:5)))
if ((size(str,2) == 7) && (strcmp('64',str(6:7))))
basekey = 'Software\Wow6432Node\OpenOffice.org';
else
basekey = 'Software\OpenOffice.org'; % for 32 bits
end

UREkey = '\Layers\URE\1';
UNOkey = '\UNO\InstallPath';

OOorgBase = winqueryreg( 'name', 'HKEY_LOCAL_MACHINE', ...
basekey);
OOorgURE = winqueryreg('HKEY_LOCAL_MACHINE', [basekey UREkey],
'UREINSTALLLOCATION');

OOorgURE = [OOorgURE 'bin\'];

OOorgUNO = winqueryreg('HKEY_LOCAL_MACHINE', [basekey UNOkey], '');

cPath = getenv('PATH');
cPath = [cPath '; ' OOorgURE];
setenv('PATH', cPath);
setenv('UNO_PATH', OOorgUNO);


end % if PCWIN

end % if OOorgBase is undefined

asy=NET.addAssembly('cli_basetypes');
asy=NET.addAssembly('cli_oootypes');
asy=NET.addAssembly('cli_ure');
asy=NET.addAssembly('cli_uretypes');
asy=NET.addAssembly('cli_cppuhelper');

--
ejs


0 new messages