String sFormatString = "NNNNMMMM DD, YYYY";
// a NumberFormatsSupplier has to be created first "in the open countryside"...
Object oNumberFormatsSupplier = m_xMCF.createInstanceWithContext("com.sun.star.util.NumberFormatsSupplier", m_xContext);
XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, oNumberFormatsSupplier);
XNumberFormats xNumberFormats = xNumberFormatsSupplier.getNumberFormats();
// is the numberformat already defined?
int nFormatKey = xNumberFormats.queryKey(sFormatString, aLocale, true);
if (nFormatKey == -1){
// if not then add it to the NumberFormatsSupplier
nFormatKey = xNumberFormats.addNew(sFormatString, aLocale);
}
// The following property may also be set with XMultiPropertySet but we
// use the XPropertySet interface merely for reasons of demonstration
xFFModelPSet.setPropertyValue("FormatsSupplier", xNumberFormatsSupplier);