sw/source/filter/ww8/docxattributeoutput.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 73f64b51d2283b6a9923781ef72fdceeb7e3d45b Author: Noel Grandin <[email protected]> AuthorDate: Tue Oct 28 21:53:00 2025 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Nov 3 13:38:57 2025 +0100 mso-test: fix formatting of w:char attribute value When loading and then saving the document from forum-mso-en-14041.docx, we end up with a string like "1f" instead of "001f" for the hex value of the w:char attribute, which is incorrect. INFO - Validating part "/word/document.xml" using schema "29500T/wml.xsd" ... ERROR - (word/document.xml:2 col:9 575) cvc-length-valid: Value '43' with length = '1' is not facet-valid with respect to length '2' for type 'ST_ShortHexNumber'. ERROR - (word/document.xml:2 col:9 575) cvc-attribute.3: The value '43' of attribute 'w:char' on element 'w:sym' is not valid with respect to its type, 'ST_ShortHexNumber'. Change-Id: Iea72e0064f09f4aa9ceb28f61596743c5b6434f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193122 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit 2c9293526e822a8ef39ca77eb6a1f6ede6de9a92) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193246 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193331 Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0565a321d20b..951e8e22d31a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -138,6 +138,7 @@ #include <textcontentcontrol.hxx> #include <formatflysplit.hxx> +#include <o3tl/sprintf.hxx> #include <o3tl/string_view.hxx> #include <o3tl/unit_conversion.hxx> #include <osl/file.hxx> @@ -3831,9 +3832,11 @@ static bool impl_WriteRunText( FSHelperPtr const & pSerializer, sal_Int32 nTextT { for (char16_t aChar : aView) { + char pBuf[5]; + o3tl::sprintf(pBuf, "%04x", aChar); pSerializer->singleElementNS(XML_w, XML_sym, FSNS(XML_w, XML_font), rSymbolFont, - FSNS(XML_w, XML_char), OString::number(aChar, 16)); + FSNS(XML_w, XML_char), pBuf); } } else
