diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx index 1c9641996cdd..4c9c7a1f2926 100644 --- a/oox/source/drawingml/textfield.cxx +++ b/oox/source/drawingml/textfield.cxx @@ -215,7 +215,9 @@ SvxDateFormat TextField::getLODateFormat(std::u16string_view rDateTimeType) if( aDateTimeNum.empty() ) // "datetime" return SvxDateFormat::StdSmall; - int nDateTimeNum = o3tl::toInt32(aDateTimeNum); + // "datetimeFigureOut", which is what PowerPoint writes in a date placeholder, is an alias of + // datetime1: MS-OI29500 part 1, 21.1.2.2.4 (fld). + int nDateTimeNum = aDateTimeNum == u"FigureOut" ? 1 : o3tl::toInt32(aDateTimeNum); switch( nDateTimeNum ) { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 3a0ae204f8d9..662c14e8b69b 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3031,6 +3031,12 @@ OUString DrawingML::GetFieldValue( const css::uno::Reference< css::text::XTextRa rXPropSet->getPropertyValue(UNO_TC_PROP_NUMFORMAT) >>= nNumFmt; aFieldValue = GetDatetimeTypeFromDate(static_cast(nNumFmt)); } + else if(aFieldKind == "DateTime") + { + // The date/time field of a header/footer area carries no format of its own - + // the page holds it - and "datetime" seems a perfect fit (see MS-OI29500). + aFieldValue = u"datetime"_ustr; + } else if(aFieldKind == "ExtTime") { sal_Int32 nNumFmt = -1; diff --git a/sd/qa/unit/data/pptx/master-and-eleven-layouts.pptx b/sd/qa/unit/data/pptx/master-and-eleven-layouts.pptx new file mode 100644 index 000000000000..5aeb1b84969a Binary files /dev/null and b/sd/qa/unit/data/pptx/master-and-eleven-layouts.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index 243fe59eb801..7719784cad05 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -2450,6 +2450,21 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCool16078_placeholderKeepsItsOutlin assertXPath(pLayout, "//p:sp[p:nvSpPr/p:nvPr/p:ph/@type='pic']/p:spPr/a:prstGeom", 0); } +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testCool16079_dateTimeField) +{ + // Given a deck whose date placeholders hold an automatically updated date: + createSdImpressDoc("pptx/master-and-eleven-layouts.pptx"); + save(TestFilter::PPTX); + + // The placeholder keeps a field. Without the fix it held our own display string as literal + // text, so PowerPoint showed "" where the original showed a date. The type is the + // one that leaves the format to the reader, which is what a field holding none asks for - the + // alias PowerPoint writes here stands for a fixed MM/DD/YYYY. + xmlDocUniquePtr pLayout = parseExportedLayoutNamed(u"Title Slide"); + assertXPath(pLayout, "//p:sp[p:nvSpPr/p:nvPr/p:ph/@type='dt']/p:txBody/a:p/a:fld", "type", + u"datetime"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */