Kaydet (Commit) 18044a60 authored tarafından sushil_shinde's avatar sushil_shinde Kaydeden (comit) Miklos Vajna

fdo#69646 Export of table with auto-width, at least one column with auto-width

 - In case of auto width to table it should export as auto.
 - Added Unit Test to check it is properly exporting table.

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

Change-Id: Id448111b81110bbc6c109f3da9195075b9b8a9fc
üst d19598b5
......@@ -2964,6 +2964,16 @@ DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.d
CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom );
}
DECLARE_OOXMLEXPORT_TEST(fdo69656, "Table_cell_auto_width_fdo69656.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");
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -2234,21 +2234,36 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
m_pSerializer->mark( aSeqOrder );
sal_uInt32 nPageSize = 0;
const char* widthType = "dxa";
bool bRelBoxSize = false;
// Create the SwWriteTable instance to use col spans (and maybe other infos)
GetTablePageSize( pTableTextNodeInfoInner.get(), nPageSize, bRelBoxSize );
// If actual width of table is relative it shoud export is as "auto".
const SwTable *pTable = pTableTextNodeInfoInner->getTable();
SwFrmFmt *pTblFmt = pTable->GetFrmFmt( );
uno::Reference<beans::XPropertySet> xPropertySet(SwXTextTables::GetObject(const_cast<SwFrmFmt&>(*pTable->GetFrmFmt( ))),uno::UNO_QUERY);
bool isWidthRelative = false;
xPropertySet->getPropertyValue("IsWidthRelative") >>= isWidthRelative;
if(isWidthRelative)
{
nPageSize = 0;
widthType = "auto";
}
else
{
// Create the SwWriteTable instance to use col spans (and maybe other infos)
GetTablePageSize( pTableTextNodeInfoInner.get(), nPageSize, bRelBoxSize );
if(nPageSize == 0)
widthType = "auto";
}
// Output the table preferred width
if ( nPageSize != 0 )
m_pSerializer->singleElementNS( XML_w, XML_tblW,
FSNS( XML_w, XML_w ), OString::number( nPageSize ).getStr( ),
FSNS( XML_w, XML_type ), "dxa",
FSEND );
m_pSerializer->singleElementNS( XML_w, XML_tblW,
FSNS( XML_w, XML_w ), OString::number( nPageSize ).getStr( ),
FSNS( XML_w, XML_type ), widthType,
FSEND );
// Output the table alignement
const SwTable *pTable = pTableTextNodeInfoInner->getTable();
SwFrmFmt *pTblFmt = pTable->GetFrmFmt( );
const char* pJcVal;
sal_Int32 nIndent = 0;
switch ( pTblFmt->GetHoriOrient( ).GetHoriOrient( ) )
......
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