[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sw/source writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 14 11:04:39 UTC 2019


 sw/source/filter/ww8/docxattributeoutput.cxx |    6 ++++++
 writerfilter/source/dmapper/SdtHelper.cxx    |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 6ab71fa2d138daa80cba8fd77419fbf2ec89b794
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 14 11:27:11 2019 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jan 14 12:04:17 2019 +0100

    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 at collabora.com>
    (cherry picked from commit 24613d7abf820aff639a276a1819ada8d83e9063)
    
    Change-Id: I5cf65bedba010f64ca8f56262057f3cce32b0943
    Reviewed-on: https://gerrit.libreoffice.org/66289
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

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;


More information about the Libreoffice-commits mailing list