maverick786us General User

Joined: 11 Jul 2012 Posts: 26
|
Posted: Tue Aug 07, 2012 3:27 am Post subject: Converting .ODT to .Doc |
|
|
I am using this code to convert .ODT file into .DOC. This whole code seems to work perfectly fine.
| Code: |
StartOpenOffice();
unoidl.com.sun.star.uno.XComponentContext xLocalContext = uno.util.Bootstrap.bootstrap();
unoidl.com.sun.star.lang.XMultiServiceFactory xRemoteFactory =
(unoidl.com.sun.star.lang.XMultiServiceFactory)xLocalContext.getServiceManager();
XComponentLoader aLoader = (XComponentLoader)xRemoteFactory.createInstance("com.sun.star.frame.Desktop");
oWord.ActiveDocument.SaveAs(tempODTFile);
oWord.ActiveDocument.Close();
[b]XComponent xComponent = initDocument(aLoader, PathConverter(tempODTFile), "_blank");[/b]
|
| Code: |
private static void saveDocument(XComponent xComponent, string sourceFile, string destinationFile)
{
PropertyValue[] propertyValues = new PropertyValue[1];
propertyValues[0] = new PropertyValue();
propertyValues[0].Name = "FilterName";
propertyValues[0].Value = new uno.Any("MS Word 97");
XStorable xcomponent1 = (xComponent) as XStorable;
xcomponent1.storeToURL(destinationFile, propertyValues);
}
|
Now there is this experssion of initializing the document. I am using this expression to load the document
| Code: |
XComponent xComponent = aLoader.loadComponentFromURL(file, target, 0, openProps);
|
What is the procedure for releasing the document? |
|