sc/source/filter/inc/tablebuffer.hxx |    8 ++++----
 sc/source/filter/oox/tablebuffer.cxx |   35 +++++++++++++++--------------------
 2 files changed, 19 insertions(+), 24 deletions(-)

New commits:
commit 6632f62040d8fe2e6260335fb5849ed33fd0d3a8
Author:     Balazs Varga <[email protected]>
AuthorDate: Tue Dec 23 20:12:39 2025 +0100
Commit:     Balazs Varga <[email protected]>
CommitDate: Mon Jan 5 08:39:29 2026 +0100

    Table Style: import table area with empty style even if
    
    XML_TableStyleInfo is not present in the ooxml file.
    
    Change-Id: If3045d5eedd1ec21f69230e641bdf6f7b7aa88d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196174
    Reviewed-by: Balazs Varga <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/source/filter/inc/tablebuffer.hxx 
b/sc/source/filter/inc/tablebuffer.hxx
index bf995393000c..886ed2bac664 100644
--- a/sc/source/filter/inc/tablebuffer.hxx
+++ b/sc/source/filter/inc/tablebuffer.hxx
@@ -28,7 +28,7 @@ namespace oox::xls {
 
 struct TableStyleInfo
 {
-    std::optional<OUString> maStyleName;
+    OUString maStyleName;
     bool mbShowFirstColumn;
     bool mbShowLastColumn;
     bool mbShowRowStripes;
@@ -63,8 +63,8 @@ public:
     AutoFilter&  createAutoFilter() { return maAutoFilters.createAutoFilter(); 
}
     /** Creates a new tableColumns handler and stores it internally. */
     TableColumns&  createTableColumns() { return 
maTableColumns.createTableColumns(); }
-
-    void importTableStyleInfo(const AttributeList& rAttribs);
+    /** Imports the table style info attributes. */
+    void importTableStyleInfo( const AttributeList& rAttribs );
 
     /** Creates a database range from this tables. */
     void                finalizeImport();
@@ -93,7 +93,7 @@ public:
 
 private:
     TableModel          maModel;
-    std::optional<TableStyleInfo> maStyleInfo;
+    TableStyleInfo      maStyleInfo;        /// Table style information.
     AutoFilterBuffer    maAutoFilters;      /// Filter settings for this table.
     TableColumnsBuffer  maTableColumns;     /// Column names of this table.
     OUString            maDBRangeName;      /// Name of the database range in 
the Calc document.
diff --git a/sc/source/filter/oox/tablebuffer.cxx 
b/sc/source/filter/oox/tablebuffer.cxx
index e2dbd282a94f..f1b767c52a41 100644
--- a/sc/source/filter/oox/tablebuffer.cxx
+++ b/sc/source/filter/oox/tablebuffer.cxx
@@ -40,11 +40,12 @@ using namespace ::com::sun::star::sheet;
 using namespace ::com::sun::star::uno;
 
 TableStyleInfo::TableStyleInfo():
-    mbShowFirstColumn(true),
-    mbShowLastColumn(true),
-    mbShowRowStripes(true),
-    mbShowColStripes(true)
+    mbShowFirstColumn( false ),
+    mbShowLastColumn( false ),
+    mbShowRowStripes( false ),
+    mbShowColStripes( false )
 {
+    maStyleName = u"none"_ustr;
 }
 
 TableModel::TableModel() :
@@ -95,14 +96,11 @@ void Table::importTable( SequenceInputStream& rStrm, 
sal_Int16 nSheet )
 
 void Table::importTableStyleInfo(const AttributeList& rAttribs)
 {
-    TableStyleInfo aInfo;
-    aInfo.maStyleName = rAttribs.getString(XML_name, u"none"_ustr);
-    aInfo.mbShowFirstColumn = rAttribs.getBool(XML_showFirstColumn, true);
-    aInfo.mbShowLastColumn = rAttribs.getBool(XML_showLastColumn, true);
-    aInfo.mbShowRowStripes = rAttribs.getBool(XML_showRowStripes, true);
-    aInfo.mbShowColStripes = rAttribs.getBool(XML_showColumnStripes, true);
-
-    maStyleInfo = aInfo;
+    maStyleInfo.maStyleName = rAttribs.getString(XML_name, u"none"_ustr);
+    maStyleInfo.mbShowFirstColumn = rAttribs.getBool(XML_showFirstColumn, 
false);
+    maStyleInfo.mbShowLastColumn = rAttribs.getBool(XML_showLastColumn, false);
+    maStyleInfo.mbShowRowStripes = rAttribs.getBool(XML_showRowStripes, false);
+    maStyleInfo.mbShowColStripes = rAttribs.getBool(XML_showColumnStripes, 
false);
 }
 
 void Table::finalizeImport()
@@ -167,14 +165,11 @@ void Table::finalizeImport()
         if( !aPropSet.getProperty( mnTokenIndex, PROP_TokenIndex ) )
             mnTokenIndex = -1;
 
-        if(maStyleInfo && maStyleInfo->maStyleName)
-        {
-            aPropSet.setProperty( PROP_TableStyleName, 
css::uno::Any(*maStyleInfo->maStyleName));
-            aPropSet.setProperty( PROP_UseRowStripes, 
maStyleInfo->mbShowRowStripes);
-            aPropSet.setProperty( PROP_UseColStripes, 
maStyleInfo->mbShowColStripes);
-            aPropSet.setProperty( PROP_UseFirstColumnFormatting, 
maStyleInfo->mbShowFirstColumn);
-            aPropSet.setProperty( PROP_UseLastColumnFormatting, 
maStyleInfo->mbShowLastColumn);
-        }
+        aPropSet.setProperty( PROP_TableStyleName, 
css::uno::Any(maStyleInfo.maStyleName));
+        aPropSet.setProperty( PROP_UseRowStripes, 
maStyleInfo.mbShowRowStripes);
+        aPropSet.setProperty( PROP_UseColStripes, 
maStyleInfo.mbShowColStripes);
+        aPropSet.setProperty( PROP_UseFirstColumnFormatting, 
maStyleInfo.mbShowFirstColumn);
+        aPropSet.setProperty( PROP_UseLastColumnFormatting, 
maStyleInfo.mbShowLastColumn);
     }
     catch( Exception& )
     {

Reply via email to