public static Map<String,Object> convertDocument(DispatchContext dctx,Map<String,? extends Object> context){
  XMultiComponentFactory xmulticomponentfactory=null;
  String stringUrl="file:///" + context.get("filenameFrom");
  String stringConvertedFile="file:///" + context.get("filenameTo");
  String filterName="file:///" + context.get("filterName");
  String oooHost=(String)context.get("oooHost");
  String oooPort=(String)context.get("oooPort");
  try {
    xmulticomponentfactory=OpenOfficeWorker.getRemoteServer(oooHost,oooPort);
    OpenOfficeWorker.convertOODocToFile(xmulticomponentfactory,stringUrl,stringConvertedFile,filterName);
    Map results=ServiceUtil.returnSuccess();
    return results;
  }
 catch (  IOException e) {
    Debug.logError(e,"Error in OpenOffice operation: ",module);
    return ServiceUtil.returnError(e.toString());
  }
catch (  Exception e) {
    Debug.logError(e,"Error in OpenOffice operation: ",module);
    return ServiceUtil.returnError(e.toString());
  }
}

public static Map < String , Object > convertDocument ( DispatchContext dctx , Map < String , ? extends Object > context ) { XMultiComponentFactory xmulticomponentfactory = null ; String stringUrl = "file:///" + context . get ( "filenameFrom" ) ; String stringConvertedFile = "file:///" + context . get ( "filenameTo" ) ; String filterName = "file:///" + context . get ( "filterName" ) ; String oooHost = ( String ) context . get ( "oooHost" ) ; String oooPort = ( String ) context . get ( "oooPort" ) ; try { xmulticomponentfactory = OpenOfficeWorker . getRemoteServer ( oooHost , oooPort ) ; OpenOfficeWorker . convertOODocToFile ( xmulticomponentfactory , stringUrl , stringConvertedFile , filterName ) ; Map results = ServiceUtil . returnSuccess ( ) ; return results ; } catch ( IOException e ) { Debug . logError ( e , "Error in OpenOffice operation: " , module ) ; return ServiceUtil . returnError ( e . toString ( ) ) ; } catch ( Exception e ) { Debug . logError ( e , "Error in OpenOffice operation: " , module ) ; return ServiceUtil . returnError ( e . toString ( ) ) ; } }
use openoffice to convert documents between types
