[Solved] Integration of LibreOffice with WPF

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
shinnguyen5589
Posts: 3
Joined: Tue Feb 25, 2014 9:46 am

[Solved] Integration of LibreOffice with WPF

Post by shinnguyen5589 »

I want to build an app, using Libreoffice api to open office documents(word, excel, powerpoint) in the same application window, writen by C#.
Can you give me some suggestions?
Thanks.
Last edited by shinnguyen5589 on Thu Feb 27, 2014 8:40 am, edited 2 times in total.
OpenOffice 3.1 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Integration of LibreOffice with WPF

Post by Villeroy »

OpenOffice documents have nothing to do with Word, Excel nor Powerpoint. Nobody here knows what WTF C# means.
OpenOffice can attach all types of supported documents (including some foreign ones) to its own window tool set.
Button, new presentation and spreadsheet in one window
Button, new presentation and spreadsheet in one window
http://www.oooforum.org/forum/viewtopic.phtml?p=36664
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
User avatar
RoryOF
Moderator
Posts: 34610
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Integration of LibreOffice with WPF

Post by RoryOF »

For information: WPF seems to stand for Windows Presentation Foundation (WPF), which links to Visual C#.

Google is your friend: start with
How to: Create a C# WPF Application
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
shinnguyen5589
Posts: 3
Joined: Tue Feb 25, 2014 9:46 am

Re: Integration of LibreOffice with WPF

Post by shinnguyen5589 »

I built an C# WPF application, this app using Libreoffice api to open office documents. But documents always open in another window. My expectation is open documents in the same window with main app.
Can you give me some suggestions?
Thanks.
OpenOffice 3.1 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Integration of LibreOffice with WPF

Post by Villeroy »

Can you do that trick with some typical Windows application?
If it has to be OpenOffcie or LibreOffice, I have suggested a working solution.
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
shinnguyen5589
Posts: 3
Joined: Tue Feb 25, 2014 9:46 am

Re: Integration of LibreOffice with WPF

Post by shinnguyen5589 »

Hi Villeroy, I don't know exactly what you mean.
This is code I use to open document

//Get a ComponentContext
unoidl.com.sun.star.uno.XComponentContext xLocalContext =
uno.util.Bootstrap.bootstrap();
//Get MultiServiceFactory
unoidl.com.sun.star.lang.XMultiServiceFactory xRemoteFactory =
(unoidl.com.sun.star.lang.XMultiServiceFactory)xLocalContext.getServiceManager();
//Get a ComponentLoader
unoidl.com.sun.star.frame.XComponentLoader xLoader = (unoidl.com.sun.star.frame.XComponentLoader)xRemoteFactory.createInstance("com.sun.star.frame.Desktop");

//Open document
unoidl.com.sun.star.beans.PropertyValue[] Args = new unoidl.com.sun.star.beans.PropertyValue[1];
XComponent xComponent = xLoader.loadComponentFromURL(@"file:///C:/Users/Documents/demo.odt", "_blank", 0, Args);
OpenOffice 3.1 on Windows 7
gabrielel
Posts: 2
Joined: Mon Sep 29, 2014 4:21 pm

Re: [Solved] Integration of LibreOffice with WPF

Post by gabrielel »

Hi! I have your same problem. Can you help me? I want to open office file in a user control WPF C#.
Thanks a lot
Gabriele

shinnguyen5589 wrote:I want to build an app, using Libreoffice api to open office documents(word, excel, powerpoint) in the same application window, writen by C#.
Can you give me some suggestions?
Thanks.
OpenOffice 3.1 Windows Vista
Post Reply