* @throws PropertyVetoException
* @throws UnknownPropertyException
*/
public void setCellFormat (XCell cell, String format, short defaultFormat) throws MalformedNumberFormatException, UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException
{
XNumberFormatsSupplier xFormatsSupplier
= (XNumberFormatsSupplier)(UnoRuntime.queryInterface(XNumberFormatsSupplier.class, mySpreadsheet));
XNumberFormatTypes xFormatTypes
= (XNumberFormatTypes)(UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormatsSupplier.getNumberFormats()));
int formatIndex;
if (format == null) {
formatIndex = xFormatTypes.getStandardFormat (defaultFormat, getLocale());
}
else {
formatIndex = xFormatsSupplier.getNumberFormats ().queryKey (format, getLocale (), false);
if (formatIndex == -1) {
formatIndex = xFormatsSupplier.getNumberFormats ().addNew (format, getLocale ());
if (formatIndex == -1) {
myLog.warn ("Bad number format code: {}", format);
}
}
}