diff options
author | László Németh <nemeth@numbertext.org> | 2018-09-18 14:43:31 +0200 |
---|---|---|
committer | Aron Budea <aron.budea@collabora.com> | 2019-01-10 12:10:12 +0100 |
commit | 51f7ebeed4d5e57dec420248bb4aa5520afbffa0 (patch) | |
tree | 7231587cb11d03cdfec32d1adaa0ba6074d30d00 /sw/qa | |
parent | 20c7a26bf1fbdb5e5e7fa6fe075fca7fe897e41d (diff) |
tdf#58944 DOCX import: workaround for hidden table headers
Repeating table headers consisted of more than 10 table rows
switch off table header repetition during DOCX table import
to fix non-visible table content and broken tables.
Repeating header lines are not visible in MSO, if there is no space for them.
OOXML (and ODF) standards don't specify this exception, and unfortunately,
it's easy to create tables with invisible repeating headers in MSO, resulting
OOXML files with non-standardized layout. To show the same or a similar layout
in LibreOffice (instead of a broken table with invisible content), we use a
reasonable 10-row limit to apply header repetition, as a workaround.
Later it's still possible to switch on header repetition or create a
better compatible repeating table header in Writer for (pretty unlikely) tables
with really repeating headers consisted of more than 10 table rows.
Note: This workaround could help to create standard and more portable OOXML
files in a mixed environment.
Reviewed-on: https://gerrit.libreoffice.org/60689
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 110781a3a27dffe9e6690839bdce993796a08331)
Change-Id: I17fbc0173ec1c4f188a46227b99dde5726530da3
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf58944-repeating-table-header.docx | bin | 0 -> 16640 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 17 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf58944-repeating-table-header.docx b/sw/qa/extras/ooxmlexport/data/tdf58944-repeating-table-header.docx Binary files differnew file mode 100644 index 000000000000..56e37362adf7 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf58944-repeating-table-header.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index e2cf32f2e7dc..9216e4369dd6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -386,6 +386,23 @@ DECLARE_OOXMLEXPORT_TEST(testOpenDocumentAsReadOnly, "open-as-read-only.docx") CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly()); } +DECLARE_OOXMLEXPORT_TEST(testTdf58944RepeatingTableHeader, "tdf58944-repeating-table-header.docx") +{ + // DOCX tables with more than 10 repeating header lines imported without repeating header lines + // as a workaround for MSO's limitation of header line repetition + xmlDocPtr pDump = parseLayoutDump(); + CPPUNIT_ASSERT_EQUAL(2, getPages()); + + // table starts on page 1 and finished on page 2 + // instead of showing only a part of it on page 2 + assertXPath(pDump, "/root/page[1]/body/tab", 1); + assertXPath(pDump, "/root/page[1]/body/tab/row", 11); + CPPUNIT_ASSERT_EQUAL(OUString("Test1"), + parseDump("/root/page[2]/body/tab/row[1]/cell[1]/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Test2"), + parseDump("/root/page[2]/body/tab/row[2]/cell[1]/txt/text()")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |