summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2016-12-17 10:53:12 +0100
committerEike Rathke <erack@redhat.com>2017-01-03 13:28:48 +0000
commit36cdf3c35459df63ce137e550a6840a61865c0ca (patch)
tree555e08d41e9bf35a15d93d3afc974696d1650eb8
parent65d10c4dedbf72f87888e14984393c222a5b31f9 (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>
-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 67b77fb7ff8c..56c749c805aa 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();
@@ -208,6 +210,7 @@ public:
CPPUNIT_TEST(testCellNoteExportXLS);
CPPUNIT_TEST(testFormatExportODS);
+ CPPUNIT_TEST(testCommentExportXLSX);
CPPUNIT_TEST(testCustomColumnWidthExportXLSX);
CPPUNIT_TEST(testXfDefaultValuesXLSX);
CPPUNIT_TEST(testColumnWidthResaveXLSX);
@@ -497,6 +500,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 3e179d247b3f..35fe29f2139f 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1190,6 +1190,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 );
@@ -1208,6 +1209,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() );
}