sw: don't export true value for cantSplit element to OOXML

Not necessary, Word doesn't export it, and OOXML
validator complains about the test doc if val attribute
is present with true value:

{"Description":"The attribute
'http://schemas.openxmlformats.org/wordprocessingml/2006/main:val'
has invalid value 'true'. The Enumeration constraint failed.",
"Path":{"Namespaces":{},"XPath":
"/w:document[1]/w:body[1]/w:tbl[2]/w:tr[1]/w:trPr[1]/w:cantSplit[1]",
"PartUri":"/word/document.xml"},
"Id":"Sch_AttributeValueDataTypeDetailed","ErrorType":"Schema"}

Change-Id: I964320ea2ef6b48795224ac14545a2eaf4a3b5bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202396
Tested-by: Jenkins
Reviewed-by: Aron Budea <aron.budea@collabora.com>
This commit is contained in:
Aron Budea
2026-03-24 16:36:17 +01:00
parent b84b64a8e1
commit 9827413548
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -953,7 +953,8 @@ CPPUNIT_TEST_FIXTURE(Test, testcantSplit)
// writing <w:cantSplit w:val="false"/> during export was causing problem that all the cell data used to come on same page
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:cantSplit",0);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:cantSplit","val",u"true");
// this is how true is represented, otherwise OOXML validator complains: <w:cantSplit/>
assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:cantSplit", "val");
}
CPPUNIT_TEST_FIXTURE(Test, testDontSplitTable)
+1 -1
View File
@@ -806,7 +806,7 @@ void DocxAttributeOutput::TableCanSplit(
// if rSplittable is true then no need to write <w:cantSplit w:val="false"/>
// as default row prop is allow row to break across page.
if (!rSplittable.GetValue())
m_pSerializer->singleElementNS(XML_w, XML_cantSplit, FSNS(XML_w, XML_val), "true");
m_pSerializer->singleElementNS(XML_w, XML_cantSplit);
}
void DocxAttributeOutput::TableBidi(