fixed tdf#162471: display comment time in ods if available

Change-Id: I2fe2621458608a2bf6c382397ec5acdaeffe3748
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171774
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Pranam Lashkari
2024-08-15 17:14:21 +02:00
committed by Caolán McNamara
parent 2ca75d4133
commit f684f284de
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -919,7 +919,14 @@ void ScXMLTableRowCellContext::SetAnnotation(const ScAddress& rPos)
if (rXMLImport.GetMM100UnitConverter().convertDateTime(fDate, mxAnnotationData->maCreateDate))
{
SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
sal_uInt32 nfIndex = pNumForm->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, LANGUAGE_SYSTEM );
// Date string is in format ISO 8601 inside <dc:date>
// i.e: 2024-08-14 or 2024-08-14T23:55:06 or 20240814T235506
// Time always has prefix 'T'
sal_uInt32 nfIndex = pNumForm->GetFormatIndex(
mxAnnotationData->maCreateDate.indexOf('T') > -1 ? NF_DATETIME_SYS_DDMMYYYY_HHMMSS
: NF_DATE_SYS_DDMMYYYY,
LANGUAGE_SYSTEM);
OUString aDate;
const Color* pColor = nullptr;
pNumForm->GetOutputString( fDate, nfIndex, aDate, &pColor );
+1 -1
View File
@@ -47,7 +47,7 @@ void XSheetAnnotation::testGetDate()
uno::Reference< sheet::XSheetAnnotation > aSheetAnnotation (init(), UNO_QUERY_THROW);
OUString aDate = aSheetAnnotation->getDate();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong date", u"01/17/2013"_ustr, aDate);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong date", u"01/17/2013 00:00:00"_ustr, aDate);
}
void XSheetAnnotation::testGetIsVisible()
{