summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-02-24 15:20:20 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-02-25 21:25:12 +0100
commit09775c1806e9dd32eee8aeff96609186368cb0e7 (patch)
treef1cba17bf7b18c69e03157da7d4442742e2d411d
parent94c9d1e61702e64c03b2261ce1359bf3e459b75a (diff)
sw: DOCX export: limit FORMDROPDOWN listEntry to Word's abilities
In theory wml.xsd says: <xsd:element name="listEntry" type="CT_String" minOccurs="0" maxOccurs="unbounded"/> In practice Word 2013 refuses to load a file with 26 listEntry in one FORMDROPDOWN field. Interestingly w:result w:val larger than the number of entries does not cause Word to complain. Go figure. Change-Id: I3a61533f9ee4ba3917a9c3bc55a483fd587f0471 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89358 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit d9634e3c9bfaf826b3d4d39e9a57d6c2d8d9a3dc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89432 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/filter/ww8/docxexport.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 312500a4502c..d025d6b712ec 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -358,12 +358,13 @@ void DocxExport::DoComboBox(const OUString& rName,
m_pDocumentFS->singleElementNS(XML_w, XML_result, FSNS(XML_w, XML_val), OString::number(nId));
- // Loop over the entries
-
- for (const auto& rItem : rListItems)
+ // unfortunately Word 2013 refuses to load DOCX with more than 25 listEntry
+ SAL_WARN_IF(25 < rListItems.getLength(), "sw.ww8", "DocxExport::DoComboBox data loss with more than 25 entries");
+ auto const nSize(std::min(sal_Int32(25), rListItems.getLength()));
+ for (auto i = 0; i < nSize; ++i)
{
m_pDocumentFS->singleElementNS( XML_w, XML_listEntry,
- FSNS( XML_w, XML_val ), rItem.toUtf8() );
+ FSNS(XML_w, XML_val), rListItems[i].toUtf8() );
}
m_pDocumentFS->endElementNS( XML_w, XML_ddList );