OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to control OpenOffice IO in C#.net

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
xyl145988
General User
General User


Joined: 04 Dec 2005
Posts: 7
Location: china

PostPosted: Sun Dec 04, 2005 7:56 pm    Post subject: How to control OpenOffice IO in C#.net Reply with quote

I will using the OpenOffice open already existent files, And then save a PDF format file.

The application must be running in background,Can't display OpenOffice desktop.

Please you help me,Thanks!
Back to top
View user's profile Send private message
LarsB
OOo Advocate
OOo Advocate


Joined: 31 Aug 2005
Posts: 445
Location: Hamburg, Germany

PostPosted: Sun Dec 04, 2005 11:54 pm    Post subject: PDF Export via C# Reply with quote

Hi,

here's a little example to do that via the CLI assemblies:

Code:
      unoidl.com.sun.star.beans.PropertyValue[] pvalueInput =
            new unoidl.com.sun.star.beans.PropertyValue[1];
         
         pvalueInput[0]            = new unoidl.com.sun.star.beans.PropertyValue();
         pvalueInput[0].Name         = "Hidden";
         pvalueInput[0].Value      = new uno.Any(true);
   
         XComponent xComponent = aLoader.loadComponentFromURL(
            "file:///D:/test1.odt", "_blank", 0,
            pvalueInput);

         unoidl.com.sun.star.beans.PropertyValue[] pvalue =
            new unoidl.com.sun.star.beans.PropertyValue[1];
         
         pvalue[0]            = new unoidl.com.sun.star.beans.PropertyValue();
         pvalue[0].Name         = "FilterName";
         pvalue[0].Value         = new uno.Any("writer_pdf_Export");

         ((XStorable)xComponent).storeToURL("file:///D:/test1.pdf", pvalue);


Hope this help Wink

Cheers
LarsB
_________________
AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In

http://www.OpenDocument4all.com/
Back to top
View user's profile Send private message Visit poster's website
xyl145988
General User
General User


Joined: 04 Dec 2005
Posts: 7
Location: china

PostPosted: Mon Dec 05, 2005 12:45 am    Post subject: Reply with quote

Thanks for your help!
Very Happy
I have a new question now:

Exclamation Can be support multithreading application development of using the CLI assemblies?
Back to top
View user's profile Send private message
LarsB
OOo Advocate
OOo Advocate


Joined: 31 Aug 2005
Posts: 445
Location: Hamburg, Germany

PostPosted: Mon Dec 05, 2005 1:27 am    Post subject: OpenOffice multithreading Reply with quote

Hi,

OpenOffice itself isn't really a multitasking application
and of course you can run several frame instances
within the assemblies, but you should build your own
connection manager. James has written a first sample
of such a manager.

http://www.oooforum.org/forum/viewtopic.phtml?t=27959

but there's some trouble now.

http://www.oooforum.org/forum/viewtopic.phtml?t=28234

Cheers
LarsB
_________________
AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In

http://www.OpenDocument4all.com/
Back to top
View user's profile Send private message Visit poster's website
xyl145988
General User
General User


Joined: 04 Dec 2005
Posts: 7
Location: china

PostPosted: Tue Dec 06, 2005 9:26 pm    Post subject: Reply with quote

HI,LarsB:

Thanks for your help!

I want to know:

How to dispose the OOo dissipative memory res?
Back to top
View user's profile Send private message
LarsB
OOo Advocate
OOo Advocate


Joined: 31 Aug 2005
Posts: 445
Location: Hamburg, Germany

PostPosted: Wed Dec 07, 2005 12:16 am    Post subject: IDisposable Reply with quote

Hi,


if you have written your own wrapper classes you should resp.
could implement the IDisposable interface of the .net framework
and release your used CLI objects. But at least OpenOffice should
release, the used memory, because you only communicate to
OpenOffice and OO is responsible fo allocating andr releasing
the used memeory.
You also could kill the OO process from the windows process
list after you finished your work. This will release immediately
all used memory.

Cheers
LarsB
_________________
AODC - A free OpenDocument Converter
AODL - An independent OpenDocument Library C#
EmbeddedOpenOffice .net UserControl C#
EmbeddedOpenOffice Visual Studio .net Add In

http://www.OpenDocument4all.com/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group