Maybe this helps a bit:

(1) Get access to known types (here only currency and date):
...
// Query the number formats supplier of the writer document
Reference < XNumberFormatsSupplier > xNumberFormatsSupplier(xTemplateComponent, UNO_QUERY_THROW); Reference < XNumberFormats > xNumberFormats = xNumberFormatsSupplier->getNumberFormats();
// Query the XNumberFormatTypes interface
Reference < XNumberFormatTypes > xNumberFormatTypes(xNumberFormats, UNO_QUERY_THROW); // Get the number format index key of the default currency format, note the empty locale for default locale
Locale aLocale;
m_nCurrencyKey = xNumberFormatTypes->getStandardFormat(com::sun::star::util::NumberFormat::CURRENCY, aLocale); m_nDateKey = xNumberFormatTypes->getStandardFormat(com::sun::star::util::NumberFormat::DATE, aLocale);
....

(2) Later: set the cell properties:
...
switch (dataType) {
case UnoDataType::CurrencyType:
xCellProps->setPropertyValue(L"NumberFormat", Any((sal_Int32)m_nCurrencyKey)); xCellCursorProps->setPropertyValue(L"ParaAdjust", Any(com::sun::star::style::ParagraphAdjust_RIGHT));
    break;
...
}

I am working with a table inside a writer document, but the spreadsheet shouldn't differ a lot.

Yes, I do know that this may not be portable, but the rest of the MFC sources isn't either :)

jg

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org

Reply via email to