sw/qa/extras/ooxmlexport/data/fdo76586.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 +++++++++++++++ writerfilter/source/dmapper/DomainMapperTableManager.cxx | 10 +++++++-- 3 files changed, 24 insertions(+), 2 deletions(-)
New commits: commit 54d913aa74962781e31290d9bb7e2d95212d994c Author: Vinaya Mandke <vinaya.man...@synerzip.com> Date: Thu Mar 27 12:07:25 2014 +0530 fdo#76586 Table column separators from individual cell widths In the test file Table Grid had only one value for entire table width while there are two cells in a table row. So the table was not imported with the correct Column Separators. Added fix to calculate column seperators from cell widths if unable to calculate from Table Grid, and all the cells have individual cell widths and there are no after and before cells. Change-Id: I466737437a18d3373e75fea5ad56c9e31eb149ec Reviewed-on: https://gerrit.libreoffice.org/8767 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ooxmlexport/data/fdo76586.docx b/sw/qa/extras/ooxmlexport/data/fdo76586.docx new file mode 100644 index 0000000..28ae05e Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76586.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index de70fa3..fd080d0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2983,6 +2983,22 @@ DECLARE_OOXMLEXPORT_TEST(testAuthorPropertySdt, "author-property.docx") // "xmlns:ns0='http://purl.org/dc/elements/1.1/' xmlns:ns1='http://schemas.openxmlformats.org/package/2006/metadata/core-properties'"); } +DECLARE_OOXMLEXPORT_TEST(testFDO76586, "fdo76586.docx") +{ + /* + * In the test file gridCol had only one value for entire table width + * while there are two cells in a table row. + * So the table was not imported with the correct cell widths + */ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + + if (!pXmlDoc) + return; + + // there is only one table in the test file + assertXPath(pXmlDoc, "//w:tblGrid/w:gridCol[1]", "w", "1601"); + assertXPath(pXmlDoc, "//w:tblGrid/w:gridCol[2]", "w", "7843"); +} #endif diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index e463ff1..fa84053 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -710,13 +710,19 @@ void DomainMapperTableManager::endOfRowAction() #endif insertRowProps(pPropMap); } - else if (pCellWidths->size() > 0 && m_nLayoutType == NS_ooxml::LN_Value_wordprocessingml_ST_TblLayout_fixed) + else if ( pCellWidths->size() > 0 && + ( m_nLayoutType == NS_ooxml::LN_Value_wordprocessingml_ST_TblLayout_fixed + || pCellWidths->size() == ( m_nGridBefore + nGrids + m_nGridAfter ) ) + ) { // If we're here, then the number of cells does not equal to the amount // defined by the grid, even after taking care of // gridSpan/gridBefore/gridAfter. Handle this by ignoring the grid and // providing the separators based on the provided cell widths, as long - // as we have a fixed layout. + // as we have a fixed layout; + // On the other hand even if the layout is not fixed, but the cell widths + // provided equal the total number of cells, and there are no after/before cells + // then use the cell widths to calculate the column separators. uno::Sequence< text::TableColumnSeparator > aSeparators(pCellWidths->size() - 1); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); sal_Int16 nSum = 0; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits