dotnet / Open-XML-SDK

Open XML SDK by Microsoft
https://www.nuget.org/packages/DocumentFormat.OpenXml/
MIT License
4.02k stars 546 forks source link

c16:uniqueID element has wrong case #1762

Closed tomjebo closed 1 week ago

tomjebo commented 2 months ago

Describe the bug When writing out the c16:uniqueId element using the UniqueID class

<c:ser>
    ...
    <c:extLst>
        <c:ext xmlns:c16="http://schemas.microsoft.com/office/drawing/2014/chart"
               uri="{C3380CC4-5D6E-409C-BE32-E72D297353CC}">
            <c16:uniqueID val="{00000000-2153-43F5-A17B-C2679033F518}" />
        </c:ext>
    </c:extLst>
</c:ser>

Observed behavior c16:uniqueID is written

Expected behavior c16:uniqueId should be written

Desktop (please complete the following information):

tomjebo commented 2 months ago

There is actually a valid element child of CT_ChartDataPointUniqueIDMapEntry named uniqueID (with capital "D") in the Office xsds. That was mistakenly processed as the element name for both the above and the child of CT_ChartUniqueIDExt that should be uniqueId (lower case "d").

We hope to get a fix into the SDK soon.

tomjebo commented 2 months ago

Update, turns out that there are two classes for the uniqueId element.

DocumentFormat.OpenXml.Office2016.Drawing.Charts.UniqueIdChartUniqueID writes c16:uniqueId DocumentFormat.OpenXml.Office2016.Drawing.Charts.UniqueID writes c16:uniqueID.

These are fine and if the correct one, UniqueIdChartUniqueID is used to append to the c:ext element in a (for example) LineSerExtension, then PowerPoint is happy.

There is a problem however, and that is the these are not added to the LineSerExtension (and other *SerExtension) classes in the SDK. So when reading the above construct in the original issue post, even with lowercase "d", the SDK will assign the class OpenXmlUnknownElement in the DOM.

This is what needs to be fixed.

mikeebowen commented 1 week ago

Closed by #1767