Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocumentFormat.OpenXml.Linq namespace-related classes have missing XName fields. #1813

Open
ThomasBarnekow opened this issue Oct 26, 2024 · 11 comments
Assignees

Comments

@ThomasBarnekow
Copy link
Collaborator

ThomasBarnekow commented Oct 26, 2024

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.sdtPr
  • W.sdtEndPr
  • W.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.smartTag
  • W.smartTagPr
@ThomasBarnekow
Copy link
Collaborator Author

@twsouthwick and @mikeebowen, any thoughts on this? This is a breaking change for any application using those tags.

@ThomasBarnekow
Copy link
Collaborator Author

@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.

@twsouthwick
Copy link
Member

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 :)

@ThomasBarnekow
Copy link
Collaborator Author

Thanks, @twsouthwick, I do understand. Just wanted to make sure it is not totally forgotten.

@twsouthwick
Copy link
Member

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 added a commit that referenced this issue Nov 22, 2024
This change adds support to the LINQ generator to include base classes
and their members so it'll be similar to what was in the 2.x version:

- Refactor LINQ generator to use a visitor pattern
- Add SdtElement expansion
- Visit base types

Part of #1813
@ThomasBarnekow
Copy link
Collaborator Author

@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.

@ThomasBarnekow
Copy link
Collaborator Author

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 ;-)

@twsouthwick
Copy link
Member

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?

@twsouthwick
Copy link
Member

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).

@ThomasBarnekow
Copy link
Collaborator Author

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.

@mikeebowen
Copy link
Collaborator

mikeebowen commented Nov 22, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants