Kaydet (Commit) 7626dc2d authored tarafından Balazs Varga's avatar Balazs Varga Kaydeden (comit) Tamás Zolnai

tdf#119562 Fix export of AutoFit property of shapes to XLSX

With this patch the "Resize shape to fit text" property
(TextAutoGrowHeight) will be exported correctly to XLSX format.

Change-Id: I488ceead452aef9096e7766f957de425c8486f85
Reviewed-on: https://gerrit.libreoffice.org/59778
Tested-by: Jenkins
Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst 1f9f3517
...@@ -2423,7 +2423,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin ...@@ -2423,7 +2423,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
mpFS->singleElementNS(XML_a, XML_prstTxWarp, XML_prst, presetWarp.toUtf8().getStr(), mpFS->singleElementNS(XML_a, XML_prstTxWarp, XML_prst, presetWarp.toUtf8().getStr(),
FSEND ); FSEND );
} }
if (GetDocumentType() == DOCUMENT_DOCX) if (GetDocumentType() == DOCUMENT_DOCX || GetDocumentType() == DOCUMENT_XLSX)
{ {
bool bTextAutoGrowHeight = false; bool bTextAutoGrowHeight = false;
GET(bTextAutoGrowHeight, TextAutoGrowHeight); GET(bTextAutoGrowHeight, TextAutoGrowHeight);
......
...@@ -188,6 +188,7 @@ public: ...@@ -188,6 +188,7 @@ public:
void testTextUnderlineColorXLSX(); void testTextUnderlineColorXLSX();
void testSheetRunParagraphPropertyXLSX(); void testSheetRunParagraphPropertyXLSX();
void testHiddenShapeXLSX(); void testHiddenShapeXLSX();
void testShapeAutofitXLSX();
void testHyperlinkXLSX(); void testHyperlinkXLSX();
void testMoveCellAnchoredShapesODS(); void testMoveCellAnchoredShapesODS();
void testMatrixMultiplicationXLSX(); void testMatrixMultiplicationXLSX();
...@@ -301,6 +302,7 @@ public: ...@@ -301,6 +302,7 @@ public:
CPPUNIT_TEST(testTextUnderlineColorXLSX); CPPUNIT_TEST(testTextUnderlineColorXLSX);
CPPUNIT_TEST(testSheetRunParagraphPropertyXLSX); CPPUNIT_TEST(testSheetRunParagraphPropertyXLSX);
CPPUNIT_TEST(testHiddenShapeXLSX); CPPUNIT_TEST(testHiddenShapeXLSX);
CPPUNIT_TEST(testShapeAutofitXLSX);
CPPUNIT_TEST(testHyperlinkXLSX); CPPUNIT_TEST(testHyperlinkXLSX);
CPPUNIT_TEST(testMoveCellAnchoredShapesODS); CPPUNIT_TEST(testMoveCellAnchoredShapesODS);
CPPUNIT_TEST(testMatrixMultiplicationXLSX); CPPUNIT_TEST(testMatrixMultiplicationXLSX);
...@@ -3549,6 +3551,20 @@ void ScExportTest::testHiddenShapeXLSX() ...@@ -3549,6 +3551,20 @@ void ScExportTest::testHiddenShapeXLSX()
assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", "1"); assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp[1]/xdr:nvSpPr/xdr:cNvPr", "hidden", "1");
} }
void ScExportTest::testShapeAutofitXLSX()
{
ScDocShellRef xDocSh = loadDoc("testShapeAutofit.", FORMAT_XLSX);
CPPUNIT_ASSERT(xDocSh.is());
xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/drawings/drawing1.xml", FORMAT_XLSX);
CPPUNIT_ASSERT(pDoc);
// TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit text" --> true
assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[1]/xdr:sp/xdr:txBody/a:bodyPr/a:spAutoFit", 1);
// TextAutoGrowHeight --> "Fit height to text" / "Resize shape to fit text" --> false
assertXPath(pDoc, "/xdr:wsDr/xdr:twoCellAnchor[2]/xdr:sp/xdr:txBody/a:bodyPr/a:noAutofit", 1);
}
void ScExportTest::testHyperlinkXLSX() void ScExportTest::testHyperlinkXLSX()
{ {
ScDocShellRef xDocSh = loadDoc("hyperlink.", FORMAT_XLSX); ScDocShellRef xDocSh = loadDoc("hyperlink.", FORMAT_XLSX);
......
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