dotnet / Open-XML-SDK

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

DocumentFormat.OpenXml.Office2016.Drawing.Charts.UniqueID creates the wrong case in the resulting XML #1766

Open skrabbe001 opened 1 month ago

skrabbe001 commented 1 month ago

DocumentFormat.OpenXml.Office2016.Drawing.Charts.UniqueID creates the wrong case in the resulting XML.

The case created by the SDK is "UniqueID" but it should be "UniqueId", otherwise the PowerPoint application (in some instances) reports an error when saving the presentation after opening it:

PowerPoint couldn't read some content in test.pptx and removed it.
Please check your presentation to see if the rest of it looks ok.

When creating unique identifiers for a chart series, then the following code creates a corrupted presentation:

using C16 = DocumentFormat.OpenXml.Office2016.Drawing.Charts;

var uniqueId = new C16.UniqueID() { Val = $"{{{seriesGuid}}}" };
ext.Append(uniqueId);

This is a workaround for the time being:

ext.InnerXml = $"<c16:uniqueId xmlns:c16=\"http://schemas.microsoft.com/office/drawing/2014/chart\" val=\"{{{seriesGuid}}}\" />";

Library Version: 3.0.1

PowerPoint Version: Microsoft® PowerPoint® for Microsoft 365 MSO (Version 2405 Build 16.0.17628.20006) 64-bit