[Libreoffice-commits] core.git: sc/qa sc/source

Bartosz Kosiorek gang65 at poczta.onet.pl
Tue Jan 3 13:29:10 UTC 2017


 sc/qa/unit/data/ods/comment.ods       |binary
 sc/qa/unit/subsequent_export-test.cxx |   21 +++++++++++++++++++++
 sc/source/filter/excel/xeescher.cxx   |    3 +++
 3 files changed, 24 insertions(+)

New commits:
commit 36cdf3c35459df63ce137e550a6840a61865c0ca
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Sat Dec 17 10:53:12 2016 +0100

    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 at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/qa/unit/data/ods/comment.ods b/sc/qa/unit/data/ods/comment.ods
new file mode 100644
index 0000000..b772a6f
Binary files /dev/null and b/sc/qa/unit/data/ods/comment.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 67b77fb..56c749c 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 3e179d2..35fe29f 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() );
         }


More information about the Libreoffice-commits mailing list