Hello, I have been using open office.org cli libraries to print the documents directly from c#. Following is my code:
Code:
public void PrintDoc(string sURL)
{
unoidl.com.sun.star.uno.XComponentContext localContext = uno.util.Bootstrap.bootstrap();
unoidl.com.sun.star.lang.XMultiServiceFactory multiServiceFactory =
(unoidl.com.sun.star.lang.XMultiServiceFactory)
localContext.getServiceManager();
//Create a new Desktop instance using our service manager
//Notice: We cast our desktop object to XComponent loader
//so that we could load or create new documents.
XComponentLoader componentLoader
=
(XComponentLoader)multiServiceFactory.createInstance(
"com.sun.star.frame.Desktop");
string sUrl = PathConverter(sURL);
PropertyValue[] loadDesc = new PropertyValue[2];
// Setting the flag for hidding the open document
loadDesc[0] = new PropertyValue();
loadDesc[0].Name = "Hidden";
loadDesc[0].Value = new uno.Any(true);
loadDesc[1] = new PropertyValue();
loadDesc[1].Name = "CharacterSet";
loadDesc[1].Value = new uno.Any(437);
// Loading the wanted document
XComponent xComp = componentLoader.loadComponentFromURL
(sUrl, "_blank", 0, loadDesc);
PropertyValue[] printerProp = new PropertyValue[1];
printerProp[0] = new PropertyValue();
printerProp[0].Name = "Name";
printerProp[0].Value = new uno.Any("PDFCreator");
XPrintable xPrintable = (XPrintable)xComp;
xPrintable.print(printerProp);
}
I need to print .wk1 files but xComponent object marked bold in above code returns null in case of .wk1 files only, whilst it works for other file types. Can anyone tell me what the problem and how can i open and print .wk1 files. Your help will be highly appreciated.
The administrator has disabled public write access.