Kaydet (Commit) c035c3dc authored tarafından Vinaya Mandke's avatar Vinaya Mandke Kaydeden (comit) Miklos Vajna

fdo#73556 Docx was exported with incorrect column width

The file contains a table with 3 columns. The girdcols
are as follows: {1210, 1331, 1210}, whereas the
individual cells have {1210, 400, 1210}.
The table column separators were taken from the grid while
the table width was calculated as 2820 from cells
instead of 3751 from the grid.
Hence the table width reduced after export to DOCX

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
	https://gerrit.libreoffice.org/7540

Change-Id: I2c590ad6b5ec9fe3e8559971ca8cfa69c5343f47
üst 3db0fdb0
......@@ -2603,6 +2603,27 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69616, "fdo69616.docx")
CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:group", "coordorigin").match("696,725"));
}
DECLARE_OOXMLEXPORT_TEST(testFdo73556,"fdo73556.docx")
{
/*
* The file contains a table with 3 columns
* the girdcols are as follows: {1210, 1331, 1210}
* whereas the individual cells have {1210, 400, 1210}
* The table column separators were taken from the Grid, while
* the table width was calculated as 2820 from cells instead
* of 3751 from the Grid.
*/
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 3);
sal_Int32 tableWidth = 0;
tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[1]", "w").toInt32();
tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32();
tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[3]", "w").toInt32();
CPPUNIT_ASSERT_EQUAL(sal_Int32(3751), tableWidth);
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -654,6 +654,20 @@ void DomainMapperTableManager::endOfRowAction()
if( pTableGrid->size() == ( m_nGridBefore + nGrids + m_nGridAfter ) && m_nCell.back( ) > 0 )
{
/*
* If table width property set earlier is smaller than the current table width,
* then replace the TABLE_WIDTH property, set earlier.
*/
TablePropertyMapPtr propMap = m_aTmpTableProperties.back();
sal_Int32 nTableWidth;
sal_Int32 nTableWidthType;
propMap->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth );
propMap->getValue( TablePropertyMap::TABLE_WIDTH_TYPE, nTableWidthType );
if ((nTableWidthType == text::SizeType::FIX) && (nTableWidth < m_nTableWidth))
{
propMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
}
uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( ) - 1 );
text::TableColumnSeparator* pSeparators = aSeparators.getArray();
sal_Int16 nLastRelPos = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment