diff --git a/sw/qa/extras/ooxmlexport/data/fdo76741.docx b/sw/qa/extras/ooxmlexport/data/fdo76741.docx new file mode 100644 index 000000000000..abe9985a14df Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76741.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index d13bb70314fb..413e4fc422ef 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2360,11 +2360,34 @@ DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx") DECLARE_OOXMLEXPORT_TEST(fdo69656, "Table_cell_auto_width_fdo69656.docx") { + // Changed the UT to check "dxa" instead of "auto" + // For this particular issue file few cells have width type "auto" + // LO supports VARIABLE and FIXED width type. + // If type is VARIABLE LO calculates width as percent of PageSize + // Else if the width is fixed it uses the width value. + // After changes for fdo76741 the fixed width is exported as "dxa" for DOCX + // Check for the width type of table and its cells. xmlDocPtr pXmlDoc = parseExport(); if (!pXmlDoc) return; - assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","auto"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","dxa"); +} + +DECLARE_OOXMLEXPORT_TEST(testFdo76741, "fdo76741.docx") +{ + + // There are two issue related to table in the saved(exported) file + // - the table alignment in saved file is "left" instead of "center" + // - the table width type in properties is "auto" instead of "dxa" + + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + + if (!pXmlDoc) + return; + assertXPath(pXmlDoc, "//w:jc", "val", "center"); + assertXPath(pXmlDoc, "//w:tblW", "w", "10081"); + assertXPath(pXmlDoc, "//w:tblW", "type", "dxa"); } DECLARE_OOXMLEXPORT_TEST(testFdo73541,"fdo73541.docx") diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index fdb323c25eb1..c05aa512587d 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2382,6 +2382,11 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableT nPageSize /= 100; } } + else + { + // As the table width is not relative, the TablePageSize equals its width + nPageSize = nTblSz; + } rPageSize = nPageSize; rRelBoxSize = bRelBoxSize; diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 336514b78438..0292c58fa12e 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -307,6 +307,20 @@ bool lcl_extractTableBorderProperty(PropertyMapPtr pTableProperties, const Prope } +bool lcl_extractHoriOrient(uno::Sequence& rFrameProperties, sal_Int32& nHoriOrient) +{ + // Shifts the frame left by the given value. + for (sal_Int32 i = 0; i < rFrameProperties.getLength(); ++i) + { + if (rFrameProperties[i].Name == "HoriOrient") + { + nHoriOrient = rFrameProperties[i].Value.get(); + return true; + } + } + return false; +} + void lcl_DecrementHoriOrientPosition(uno::Sequence& rFrameProperties, sal_Int32 nAmount) { // Shifts the frame left by the given value. @@ -543,7 +557,9 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo } sal_Int32 nHoriOrient = text::HoriOrientation::LEFT_AND_WIDTH; - m_aTableProperties->getValue( TablePropertyMap::HORI_ORIENT, nHoriOrient ) ; + // Fetch Horizontal Orientation in rFrameProperties if not set in m_aTableProperties + if ( !m_aTableProperties->getValue( TablePropertyMap::HORI_ORIENT, nHoriOrient ) ) + lcl_extractHoriOrient( rFrameProperties, nHoriOrient ); m_aTableProperties->Insert( PROP_HORI_ORIENT, uno::makeAny( sal_Int16(nHoriOrient) ) ); //fill default value - if not available const PropertyMap::const_iterator aRepeatIter =