Open-XML-SDK icon indicating copy to clipboard operation
Open-XML-SDK copied to clipboard

The `DocumentFormat.OpenXml.Office2010.Drawing.TextMath` should not inherit OpenXmlLeafElement

Open lindexi opened this issue 4 months ago • 1 comments

Describe the bug

The DocumentFormat.OpenXml.Office2010.Drawing.TextMath (a14:m) is inherit OpenXmlLeafElement now. But as the document says, the DocumentFormat.OpenXml.Office2010.Drawing.TextMath (a14:m) will contain the OfficeMath element.

The sample OpenXML document:

              <a:p>
                <a:r>
                  <a:rPr lang="en-US" altLang="zh-CN" dirty="0" />
                  <a:t>123</a:t>
                </a:r>
                <a14:m>
                  <m:oMath xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">
                    <m:r>
                      <a:rPr lang="en-US" altLang="zh-CN" b="0" i="1" smtClean="0">
                        <a:latin typeface="Cambria Math" panose="02040503050406030204" pitchFamily="18" charset="0" />
                      </a:rPr>
                      <m:t>123</m:t>
                    </m:r>
                  </m:oMath>
                </a14:m>
                <a:endParaRPr lang="zh-CN" altLang="en-US" dirty="0" />
              </a:p>

As the [MS-ODRAWXML]-181211 says:

2.3.3.41 CT_TextMath

Target namespace: http://schemas.microsoft.com/office/drawing/2010/main Referenced by: m This type contains either a math zone or document-level math properties. Math zone content can be either an inline math zone or a math paragraph. Child Elements: m:oMath: A CT_OMath ([ISO/IEC29500-1:2016] section 22.1.2.77) element that specifies an instance of mathematical text.
The following W3C XML Schema ([XMLSCHEMA1/2] section 2.1) fragment specifies the contents of this complex type. <xsd:complexType name="CT_TextMath"> xsd:sequence <xsd:element ref="m:oMath"/> </xsd:sequence> </xsd:complexType> See section 5.1 for the full W3C XML Schema ([XMLSCHEMA1/2] section 2.1).

And

  <xsd:complexType name="CT_TextMath"> 
     <xsd:sequence> 
       <xsd:element ref="m:oMath"/> 
     </xsd:sequence> 
   </xsd:complexType>

Screenshots If applicable, add screenshots to help explain your problem.

To Reproduce None.

Observed behavior

We can not get the ChildElements from DocumentFormat.OpenXml.Office2010.Drawing.TextMath. And it will cause some unexpected behavior, such as https://github.com/dotnet/Open-XML-SDK/issues/1033

Expected behavior

The DocumentFormat.OpenXml.Office2010.Drawing.TextMath should inherit OpenXmlCompositeElement type.

Desktop (please complete the following information):

  • OS: [e.g. Windows]
  • Office version [e.g. 16.0.15427.20178]
  • .NET Target: (e.g. .NET Framework, .NET Core, UWP, Xamarin...)
  • DocumentFormat.OpenXml Version: (e.g. 2.11.0)

Additional context Add any other context about the problem here.

lindexi avatar Jun 20 '25 09:06 lindexi