oox/source/export/drawingml.cxx                    |   12 ++++++------
 sc/qa/unit/data/ods/tdf170670-Blank-width-char.ods |binary
 sc/qa/unit/subsequent_export_test4.cxx             |   10 ++++++++++
 xmloff/source/style/xmlnumfi.cxx                   |    7 ++++---
 4 files changed, 20 insertions(+), 9 deletions(-)

New commits:
commit 1ce819b051c04d8cfc201687cb62b8675124e4f2
Author:     Laurent Balland <[email protected]>
AuthorDate: Fri Feb 13 08:01:06 2026 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Feb 20 19:59:29 2026 +0100

    tdf#170670 NumberFormat: fix blank width string treatment
    
    In case of 2 characters string text,
    with a delimiter as text and a blank width string like
    "-"_)
    the delimiter is now treated as text
    
    Add qa test with format of bug report:
    [>0]#,##0_);[<0](#,##0);"-"_)
    
    Change-Id: Idd4542bd186c6b6b348f6716bee2fd5055f2c83f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199314
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit fb07ca38af165b1e367aea04aa626e073b341c8f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199416
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit 65fb77dc2c469370bd8486da662d8651f01ada15)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199797

diff --git a/sc/qa/unit/data/ods/tdf170670-Blank-width-char.ods 
b/sc/qa/unit/data/ods/tdf170670-Blank-width-char.ods
new file mode 100644
index 000000000000..50918deb662f
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf170670-Blank-width-char.ods 
differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 30f223630afd..78d70da01520 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -1786,6 +1786,16 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, 
testBlankWidthCharacter)
     // save to XLSX and reload
     saveAndReload(u"Calc Office Open XML"_ustr);
     lcl_TestNumberFormat(*getScDoc(), u"_-?0;-?0;_-?0;@"_ustr);
+
+    createScDoc("ods/tdf170670-Blank-width-char.ods");
+
+    // save to ODS and reload
+    saveAndReload(TestFilter::ODS);
+    lcl_TestNumberFormat(*getScDoc(), u"[>0]#,##0_);[<0](#,##0);\"-\"_)"_ustr);
+
+    // save to XLSX and reload
+    saveAndReload(TestFilter::XLSX);
+    lcl_TestNumberFormat(*getScDoc(), u"#,##0_);\(#,##0\);-_)"_ustr);
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest4, testEmbeddedTextInDecimal)
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 8803bf63f6de..5ae23b97892e 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -527,13 +527,13 @@ static bool lcl_ValidChar( sal_Unicode cChar, const 
SvXMLNumFormatContext& rPare
     return false;
 }
 
-static void lcl_EnquoteIfNecessary( OUStringBuffer& rContent, const 
SvXMLNumFormatContext& rParent )
+static void lcl_EnquoteIfNecessary( OUStringBuffer& rContent, const 
SvXMLNumFormatContext& rParent, const bool bIsBlankWidthStringEmpty = true )
 {
     bool bQuote = true;
     sal_Int32 nLength = rContent.getLength();
     const SvXMLStylesTokens nFormatType = rParent.GetType();
 
-    if (nFormatType != SvXMLStylesTokens::BOOLEAN_STYLE &&
+    if (nFormatType != SvXMLStylesTokens::BOOLEAN_STYLE && 
bIsBlankWidthStringEmpty &&
             ((nLength == 1 && lcl_ValidChar( rContent[0], rParent)) ||
              (nLength == 2 &&
               ((rContent[0] == ' ' && rContent[1] == '-') ||
@@ -544,6 +544,7 @@ static void lcl_EnquoteIfNecessary( OUStringBuffer& 
rContent, const SvXMLNumForm
         //  Or space followed by minus (used in currency formats) that would
         //  lead to almost duplicated formats with built-in formats just with
         //  the difference of quotes.
+        //  tdf#170670: except if it is inside a blank width string
         bQuote = false;
     }
     else if ( nFormatType == SvXMLStylesTokens::PERCENTAGE_STYLE && nLength > 
1 )
@@ -971,7 +972,7 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
             }
             if ( !aContent.isEmpty() )
             {
-                lcl_EnquoteIfNecessary( aContent, rParent );
+                lcl_EnquoteIfNecessary( aContent, rParent, 
sBlankWidthString.isEmpty() );
                 if ( !sBlankWidthString.isEmpty() )
                 {
                     lcl_InsertBlankWidthChars( sBlankWidthString, aContent );
commit 511b979fc48ecbd3a14529cdeba382edc22d3162
Author:     Justin Luth <[email protected]>
AuthorDate: Tue Feb 17 13:50:57 2026 -0500
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Feb 20 19:59:24 2026 +0100

    tdf#169487 tdf#169705: docx export: invalid values in a:chExt / a:off
    
    MS Office is not accepting values greater than 2147483647
    for 'x' and 'y' attributes inside a:off,
    or 'cx' and 'cy' attributes inside 'a:chExt'
    
    MSO was reporting those documents as corrupt.
    Specifically, attachment 72701 from bug 59153
    'WAD-Lab Manual.docx' aka fdo59153-1.docx
    
    Change-Id: I67dd47781098b0dfe9d12f75f591138d0e80c2f8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199569
    Reviewed-by: Justin Luth <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 55507043004d55816cdc238733a9f5c7a2240f2d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199582
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit f5f9ab2ae10e05e07330cee765baa949a619e294)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199669

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 462d68303a97..7e119c3852a4 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2325,12 +2325,12 @@ void DrawingML::WriteTransformation(const Reference< 
XShape >& xShape, const too
 
     if (bIsGroupShape && (GetDocumentType() != DOCUMENT_DOCX || 
IsTopGroupObj(xShape)))
     {
-        mpFS->singleElementNS(XML_a, XML_chOff,
-            XML_x, 
OString::number(oox::drawingml::convertHmmToEmu(nChildLeft)),
-            XML_y, 
OString::number(oox::drawingml::convertHmmToEmu(nChildTop)));
-        mpFS->singleElementNS(XML_a, XML_chExt,
-            XML_cx, 
OString::number(oox::drawingml::convertHmmToEmu(rRect.GetWidth())),
-            XML_cy, 
OString::number(oox::drawingml::convertHmmToEmu(rRect.GetHeight())));
+        nX = std::min(oox::drawingml::convertHmmToEmu(nChildLeft), MAX_SIZE);
+        nY = std::min(oox::drawingml::convertHmmToEmu(nChildTop), MAX_SIZE);
+        mpFS->singleElementNS(
+            XML_a, XML_chOff, XML_x, OString::number(nX), XML_y, 
OString::number(nY));
+        mpFS->singleElementNS(
+            XML_a, XML_chExt, XML_cx, OString::number(nCx), XML_cy, 
OString::number(nCy));
     }
 
     mpFS->endElementNS( nXmlNamespace, XML_xfrm );

Reply via email to