| View previous topic :: View next topic |
| Author |
Message |
xyl145988 General User

Joined: 04 Dec 2005 Posts: 7 Location: china
|
Posted: Sun Dec 04, 2005 7:56 pm Post subject: How to control OpenOffice IO in C#.net |
|
|
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 |
|
 |
LarsB OOo Advocate


Joined: 31 Aug 2005 Posts: 445 Location: Hamburg, Germany
|
Posted: Sun Dec 04, 2005 11:54 pm Post subject: PDF Export via C# |
|
|
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
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 |
|
 |
xyl145988 General User

Joined: 04 Dec 2005 Posts: 7 Location: china
|
Posted: Mon Dec 05, 2005 12:45 am Post subject: |
|
|
Thanks for your help!
I have a new question now:
Can be support multithreading application development of using the CLI assemblies? |
|
| Back to top |
|
 |
LarsB OOo Advocate


Joined: 31 Aug 2005 Posts: 445 Location: Hamburg, Germany
|
|
| Back to top |
|
 |
xyl145988 General User

Joined: 04 Dec 2005 Posts: 7 Location: china
|
Posted: Tue Dec 06, 2005 9:26 pm Post subject: |
|
|
HI,LarsB:
Thanks for your help!
I want to know:
How to dispose the OOo dissipative memory res? |
|
| Back to top |
|
 |
LarsB OOo Advocate


Joined: 31 Aug 2005 Posts: 445 Location: Hamburg, Germany
|
Posted: Wed Dec 07, 2005 12:16 am Post subject: IDisposable |
|
|
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 |
|
 |
|