oox/source/export/vmlexport.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit a415b2e58dad959a6fdaf3218822c51003e3dad5
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Jan 12 21:02:56 2026 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Jan 14 15:36:39 2026 +0100

    officeotron says that o:spt needs to be numeric
    
    Change-Id: I9d2f995d7cdc2feae547b61e60f75ed608277386
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197137
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit ad70c58224084f8f390cd01713f8fd03962680d0)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197235
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 905e63c47eac..529e6d99e82b 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1261,12 +1261,21 @@ sal_uInt32 VMLExport::GenerateShapeId()
 OString VMLExport::GetVMLShapeTypeDefinition(
     std::string_view sShapeID, const bool bIsPictureFrame )
 {
+    // officeotron says that o:spt needs to be numeric
+    sal_Int32 nSptId = 0;
+    std::string_view sRest;
+    if (o3tl::starts_with(sShapeID, "ole_rId", &sRest))
+        nSptId = o3tl::toInt32(sRest);
+    else
+        nSptId = o3tl::toInt32(sShapeID);
+    SAL_WARN_IF(nSptId == 0, "oox", "o:spt needs to be numeric, but we have " 
<< sShapeID);
+    assert(nSptId != 0);
     OString sShapeType;
     if ( !bIsPictureFrame )
         // We don't have a shape definition for host control in 
presetShapeDefinitions.xml
         // So use a definition copied from DOCX file created with MSO
         sShapeType = OString::Concat("<v:shapetype id=\"_x0000_t") + sShapeID +
-                        "\" coordsize=\"21600,21600\" o:spt=\"" + sShapeID +
+                        "\" coordsize=\"21600,21600\" o:spt=\"" + 
OString::number(nSptId) +
                         "\" path=\"m,l,21600l21600,21600l21600,xe\">
"
                         "<v:stroke joinstyle=\"miter\"/>
"
                         "<v:path shadowok=\"f\" o:extrusionok=\"f\" 
strokeok=\"f\" fillok=\"f\" o:connecttype=\"rect\"/>
"
@@ -1276,7 +1285,7 @@ OString VMLExport::GetVMLShapeTypeDefinition(
         // We don't have a shape definition for picture frame in 
presetShapeDefinitions.xml
         // So use a definition copied from DOCX file created with MSO
         sShapeType = OString::Concat("<v:shapetype id=\"_x0000_t") + sShapeID +
-                        "\" coordsize=\"21600,21600\" o:spt=\"" + sShapeID +
+                        "\" coordsize=\"21600,21600\" o:spt=\"" + 
OString::number(nSptId) +
                         "\" o:preferrelative=\"t\" 
path=\"m@4@5l@4@11@9@11@9@5xe\" filled=\"f\" stroked=\"f\">
"
                         "<v:stroke joinstyle=\"miter\"/>
"
                         "<v:formulas>
"

Reply via email to