Ask Your Question
0

C# Binding and GUI manipulation

asked 2018-01-19 23:35:48 +0200

Eager2008 gravatar image

I have a dll (ActiveX) made by bad old VB6. This has one special object which is instantiated by a small "stub" code written in VBA and running in Excel. After instantiation, the stub code simply calls an Init method on the special object mentioned above, this Init method contains the workbook as a reference. (The reason for the Init method is that ActiveX/COM does not support parameterized constructors). This Init method then "goes back" to the Excel application and sets up menus and handlers for the menu items which are then run in the VB6 dll.

I would like to make something similar with LibreOffice (5.4 currently) and .net (C#). ActiveX/COM is not mandatory, not even preferable if good alternatives exist for some kind of RPC) It is not absolutely necessary (though preferably) that the C# code sets up menus and menu items, but it is mandatory that C# code is called as handlers for these.

Is this possible without forking LO code? Any hint/links to tutorials on how to proceed?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-01-20 20:06:27 +0200

Jim K gravatar image

updated 2018-01-20 20:11:00 +0200

With LibreOffice, it would probably be easier to do something like this in Java than in C#. As the languages are similar, hopefully it would not require too much effort to learn the differences.

Have a look at https://api.libreoffice.org/examples/... for some possibilities, including C#. Once you have a clearer understanding of the direction you want to take, ask a specific question and we can give better answers.

Introductory information on creating menus via the API is at http://www.oracle.com/technetwork/art....

edit flag offensive delete link more

Comments

Thanks for your advice However, with all the investments (money and learning) I have done in Visual Studio, C# and .Net, Java is (probably) out of the question for me.

I can only find one cli_.dll and that is cli_uno.dll, it contains only 3 classes (even though some other namespaces are declared in it e.g. com.sun.star., but they do not contains any types). I cannot easily see how to use these 3 classes and I feel that something is missing.

Continue in next comment (length restrictions)

Eager2008 gravatar imageEager2008 ( 2018-01-21 17:02:29 +0200 )edit

Anyone, please explain what is needed for the following "use case": LibreOffice basic to instanciate an object in .net (by COM or other means). This object gets a reference to the LO application, adds some menus (thanks Jim K for a reference to how to do this by Java), I assume this is possible by C# (perhaps by a missing dll, ref previous comment). Click handlers for the menus then written in C#, actions will then be executed, possibly read/manipulation of Calc or acting on other objects.

Eager2008 gravatar imageEager2008 ( 2018-01-21 17:08:23 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-01-19 23:35:48 +0200

Seen: 875 times

Last updated: Jan 20 '18