AnsweredAssumed Answered

getting the correct filter [openoffice-document-formats.xm]

Question asked by luisalves00 on Jul 19, 2010

I'm doing this to get the correct OO filter for saving a document:

String sourceExtension = getMimetypeService().getExtension(mimetype);
           DocumentFormatRegistry formatRegistry = new XmlDocumentFormatRegistry(); 
           DocumentFormat sourceFormat = formatRegistry.getFormatByFileExtension(sourceExtension);
           DocumentFamily sourceFamily = null;
           if(sourceFormat != null){
           sourceFamily = sourceFormat.getFamily();

The problems is that XmlDocumentFormatRegistry();  uses a "document-formats.xml" file (that is insede the library package). This file is old and don't have the docx extension, but Alfresco has this file: openoffice-document-formats.xml.

this file contains all I need, but I don't know if there is any class (service/util) where I can getFormatByFileExtension(sourceExtension) using that file. Help please.

best regards,
Luís Alves