DocumentFormat.OpenXml.Linq namespace-related classes have missing XName fields.
Describe the bug
The generated classes in the DocumentFormat.OpenXml.Linq namespace (e.g., W) are missing certain XName fields that were still present in previous versions of the SDK (e.g., 2.19.0). For example, the following fields are missing (among possibly others that I did not see):
W.sdtPrW.sdtEndPrW.tag
To Reproduce To reproduce, just try to reference any of the above in your code.
Observed behavior
XName fields are suddenly no longer generated.
Expected behavior All relevant fields should be generated.
Desktop (please complete the following information):
- OS: any
- Office version: any
- .NET Target: any
- DocumentFormat.OpenXml Version: 3.1.1
Additional context 3.1.1 is the first release after 3.x that I am trying. I previously used 2.19.0 and possibly 2.20.0. Thus, I don't know exactly when the issue first appeared.
Edit November 22, 2024: It turns out the SmartTag-related fields were not part of 2.19.0:
W.smartTagW.smartTagPr
@twsouthwick and @mikeebowen, any thoughts on this? This is a breaking change for any application using those tags.
@twsouthwick and @mikeebowen, are there any plans to fix this bug? I guess content controls didn't suddenly disappear in Microsoft Word. To the contrary, the last time I participated in Office add-in community calls, support for content controls was being improved.
Sorry for the delay. I've started working through the backlog after being focused on a different project (i.e. got a fix for #1814 yesterday).
Trying to prioritize the issues that have come in :)
Thanks, @twsouthwick, I do understand. Just wanted to make sure it is not totally forgotten.
I got a fix for include the SdtPr and related types. However, I don't see W:smartTag or W:smartTagPr anywhere in the input data.
@mikeebowen @tomjebo can you take a look at if those are included?
@ThomasBarnekow have you been able to use a strongly typed element for those types?
@twsouthwick, I don't remember using the strongly-typed class for w:smartTag. The reason might be that smart tags were deprecated in Office 2010, so they were not supported since the Open XML SDK 2.5 (see this stackoverflow.com post).
However, the w:smartTag element is part of the standard, if you look at datypic.com or c-rex.net, for example. The Open XML PowerTools also supported them for compatibility reasons (e.g., in case you came across an Office 2007 document that still had them). Thus, when creating the original feature (kind of too long ago to firmly remember), I might have added certain tags without them being reflected in strongly-typed classes. What I can tell you is that they were still present in the Open XML SDK v2.19.0.
P.S.: If the w:smartTag related field of the W class (i.e., W.smartTag) were to be deprecated, I could certainly live with that. It's been a long time (more than 10 years) since they were deprecated. On the other hand, Microsoft will also be supporting .NET 3.5 until 2029 ;-)
That makes sense. I don't see anything in the 2.20 version for that being special cased, but I also don't see it in the generated file: https://github.com/dotnet/Open-XML-SDK/blob/v2.19.0/src/DocumentFormat.OpenXml.Linq/GeneratedCode/W.g.cs. Can you verify that it was actually there?
We can always add it outside of the generation - if you have a snippet of what it should look like, you can create a PR for the LINQ project to add it (back).
Just checked. I stand corrected. The w:smartTag-related fields were not available in v2.19.0. I must have also referenced the Open XML PowerTools and resolved them from there. Thus, their absence is not a breaking change. I'll correct the original post.
It looks like the smartTag and smartTagPr are being purposely removed. The commit is from a file move 7 years ago, so there's no context.