summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2016-12-17 10:53:12 +0100
committerAndras Timar <andras.timar@collabora.com>2017-03-26 21:34:48 +0200
commitc44e25d3c0536c7b963e9102941d42abf1e154b6 (patch)
treee7a99964e1b8e443b59e0a7bc23cea6918c27318
parent0d8837b7d03dd4d82ca28919c4b106bf5724214a (diff)
tdf#104729 FILESAVE Save author name in comment during export to .xlsx
Change-Id: I59d46f6a713e4f252844cda0f631ace239d73cdb Reviewed-on: https://gerrit.libreoffice.org/32115 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 36cdf3c35459df63ce137e550a6840a61865c0ca) (cherry picked from commit b61abf2d3d8638ace8abd08911b06a3ab1478799)
-rw-r--r--sc/qa/unit/data/ods/comment.odsbin0 -> 8636 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx21
-rw-r--r--sc/source/filter/excel/xeescher.cxx3
3 files changed, 24 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/comment.ods b/sc/qa/unit/data/ods/comment.ods
new file mode 100644
index 000000000000..b772a6f00395
--- /dev/null
+++ b/sc/qa/unit/data/ods/comment.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 7060520294d8..b5c2cd2f83dd 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -108,6 +108,8 @@ public:
void testCellNoteExportXLS();
void testFormatExportODS();
+
+ void testCommentExportXLSX();
void testCustomColumnWidthExportXLSX();
void testXfDefaultValuesXLSX();
void testColumnWidthResaveXLSX();
@@ -209,6 +211,7 @@ public:
CPPUNIT_TEST(testCellNoteExportXLS);
CPPUNIT_TEST(testFormatExportODS);
+ CPPUNIT_TEST(testCommentExportXLSX);
CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
CPPUNIT_TEST(testXfDefaultValuesXLSX);
CPPUNIT_TEST(testColumnWidthResaveXLSX);
@@ -499,6 +502,24 @@ void ScExportTest::testFormatExportODS()
xDocSh->DoClose();
}
+
+void ScExportTest::testCommentExportXLSX()
+{
+ //tdf#104729 FILESAVE OpenOffice do not save author of the comment during export to .xlsx
+ ScDocShellRef xShell = loadDoc("comment.", FORMAT_ODS);
+ CPPUNIT_ASSERT(xShell.Is());
+
+ std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+ xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml");
+ CPPUNIT_ASSERT(pSheet);
+
+ assertXPath(pSheet, "/x:comments/x:authors/x:author[1]", "BAKO");
+ assertXPath(pSheet, "/x:comments/x:authors/x:author", 1);
+
+ assertXPath(pSheet, "/x:comments/x:commentList/x:comment/x:text/x:r/x:t", "Komentarz");
+
+}
+
void ScExportTest::testCustomColumnWidthExportXLSX()
{
//tdf#100946 FILESAVE Excel on OS X ignored column widths in XLSX last saved by LO
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index c5a66a5a2e5b..1681aabdef08 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1184,6 +1184,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
{
// TODO: additional text
if( pScNote )
+ {
if( SdrCaptionObj* pCaption = pScNote->GetOrCreateCaption( maScPos ) )
{
lcl_GetFromTo( rRoot, pCaption->GetLogicRect(), maScPos.Tab(), maCommentFrom, maCommentTo );
@@ -1202,6 +1203,8 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
mbRowHidden = (rRoot.GetDoc().RowHidden(maScPos.Row(),maScPos.Tab()));
mbColHidden = (rRoot.GetDoc().ColHidden(maScPos.Col(),maScPos.Tab()));
}
+ maAuthor = XclExpString( pScNote->GetAuthor() );
+ }
SetRecSize( 9 + maAuthor.GetSize() );
}