summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-01-14 11:27:11 +0100
committerAndras Timar <andras.timar@collabora.com>2019-01-14 12:04:17 +0100
commit6ab71fa2d138daa80cba8fd77419fbf2ec89b794 (patch)
tree2eec81dbcf84943dda52d1fddddc3947d74f1c64
parentdccc5215f23c5c88e6c71b669d8a550a28dc4b0d (diff)
tdf#122658: Empty date form field is not exported correctly to DOCX file
We need to export date format and also text content in case of empty date field. Otherwise the exported date field will be lost during import into LO Writer or MSO Word. Reviewed-on: https://gerrit.libreoffice.org/66194 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 24613d7abf820aff639a276a1819ada8d83e9063) Change-Id: I5cf65bedba010f64ca8f56262057f3cce32b0943 Reviewed-on: https://gerrit.libreoffice.org/66289 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx6
-rw-r--r--writerfilter/source/dmapper/SdtHelper.cxx2
2 files changed, 7 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 915075964cf5..67846f34f73a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4997,7 +4997,13 @@ void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject)
}
}
else
+ {
aContentText = xPropertySet->getPropertyValue("HelpText").get<OUString>();
+ if(aContentText.isEmpty())
+ aContentText = " "; // Need to write out something to have it imported by MS Word
+ if(sDateFormat.isEmpty())
+ sDateFormat = "dd/MM/yyyy"; // Need to set date format even if there is no date set
+ }
// output component
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index 2e93f1b98c83..831b8664097b 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -125,7 +125,7 @@ void SdtHelper::createDateControl(OUString const& rContentText, const beans::Pro
xPropertySet->setPropertyValue("Date", uno::makeAny(aDate));
}
else
- xPropertySet->setPropertyValue("HelpText", uno::makeAny(rContentText));
+ xPropertySet->setPropertyValue("HelpText", uno::makeAny(rContentText.trim()));
// append date format to grab bag
comphelper::SequenceAsHashMap aGrabBag;