Hi all,
First, Sorry for my bad English.
I'm working on a automatic generation of a document, exported after modification in pdf format.
It is working very well, but now that I know my document is good, and correclty generated in pdf format, I want to do it without it is opened visually by open office, that means the user will not see his openoffice document, but just his pdf document.
In the code that I used for pdf formatting creates a XComponent, that is load from URL with "_blanck" target.
Itry to use "Hidden", but it seems to be not existing.
How to i create a XComponent to be used as a XStorage without opening it in a frame ?
Thank you for your responses
[Solved] Modify document without opening it visually
-
jacklafrip
- Posts: 7
- Joined: Mon May 30, 2011 11:41 am
[Solved] Modify document without opening it visually
Last edited by Hagar Delest on Mon May 30, 2011 8:41 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OpenOffice 3.3 on WindowsXP / VisualStudio 2005
Re: Modify document without opening it visually
If you are using the loadComponentFromURL method, the fourth argument is an array of PropertyValues. The possible values of this array are listed here. As you can see, one of these is called Hidden. In OOo Basic this could be used like this
where sURL is a valid document URL. I didn't actually test that code, so I hope it doesn't have any stupid mistakes.
Code: Select all
Dim Propvals(0) as New com.sun.star.beans.PropertyValue
Propvals(0).Name = Hidden
Propvals(0).Value = True
oDoc = StarDesktop.loadComponentFromURL(sURL, "_blank", 0, Propvals())where sURL is a valid document URL. I didn't actually test that code, so I hope it doesn't have any stupid mistakes.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
-
jacklafrip
- Posts: 7
- Joined: Mon May 30, 2011 11:41 am
Re: Modify document without opening it visually
Dera FJCC,
Thank you for your answer.
I have try this following code.
But then, xComponent is always "null".
if I comment the Name assignation, or the Value assignation, there is no problem OpenOffice starts and xComponent is not null.
Do you have any idea? Should I use another method?
Best regards,
Thank you for your answer.
I have try this following code.
Code: Select all
static XComponent initDocument(XComponentLoader aLoader, string file, string target)
{
unoidl.com.sun.star.beans.PropertyValue[] propertyValue = new unoidl.com.sun.star.beans.PropertyValue[1];
propertyValue[0] = new unoidl.com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Hidden";
propertyValue[0].Value = new uno.Any("true");
XComponent xComponent = aLoader.loadComponentFromURL(file, target, 0, propertyValue);
return xComponent;
}
if I comment the Name assignation, or the Value assignation, there is no problem OpenOffice starts and xComponent is not null.
Do you have any idea? Should I use another method?
Best regards,
OpenOffice 3.3 on WindowsXP / VisualStudio 2005
-
jacklafrip
- Posts: 7
- Joined: Mon May 30, 2011 11:41 am
Re: Modify document without opening it visually
Sorry,
I did a big mistake.
I had to use an Any with a boolean, not with a String.
So the good code is the following:
This now is fully functional.
Bye
I did a big mistake.
I had to use an Any with a boolean, not with a String.
So the good code is the following:
Code: Select all
static XComponent initDocument(XComponentLoader aLoader, string file, string target)
{
unoidl.com.sun.star.beans.PropertyValue[] propertyValue = new unoidl.com.sun.star.beans.PropertyValue[1];
propertyValue[0] = new unoidl.com.sun.star.beans.PropertyValue();
propertyValue[0].Name = "Hidden";
propertyValue[0].Value = new uno.Any(true);
XComponent xComponent = aLoader.loadComponentFromURL(file, target, 0, propertyValue);
return xComponent;
}
Bye