DocumentFormat.OpenXml v2.20 breaks Radzen

NuGet just updated DocumentFormat.OpenXml to latest version 2.20.
They depricated a command and now Radzen cannot compile.

Here is the error:
error CS0619: 'OpenXmlUnknownElement.CreateOpenXmlUnknownElement(string)' is obsolete: 'Use extension method CreateUnknownElement off of a part container'

Works normally with the version used in our templates.

Version 2.20? it worked fine for me at v2.19, but not after updating it

1 Like

Not sure why you need to update it. We’re not using this version.

1 Like

NuGet manage updated it to 2.20

The line it is having issue with is in ExportController.cs ... this is a Radzen file correct?

Yes, this controller is generated by Rafzen however the code is tested only with the versions used by default. If you update some references to newer version we cannot guarantee that the application will work as expected.

1 Like

Thanks, enchev, I guess... I went ahead and downgraded the package to 2.19 and all is well.

Note to everyone reading this, pay attention to what NuGet wants to do for you automatically.



Is there something you use to have NuGets automatically update and/or at least notify when new NuGets are available? "NuGet manage" is a product/add in?


We've decided to update our templates to be compatible with 2.20.0. Here is how to change the code at your end if you want to update to this version:

OpenXmlUnknownElement openXmlUnknownElement4 = workbookStylesPart1.CreateUnknownElement("<x15:timelineStyles defaultTimelineStyle=\"TimeSlicerStyleLight1\" xmlns:x15=\"\" />");

Thank you.

It’s nice to be able to update to latest!

1 Like

I have tried to implement the change, but I am still getting the error:

Looks like you are using VB? Can you post your code? Radzen doesn’t have VB support for Blazor projects. If you are using Angular with VB here is how to change the code in XlsDataContractSerializerOutputFormatter.vb:

Dim openXmlUnknownElement4 As OpenXmlUnknownElement = workbookStylesPart1.CreateUnknownElement("<x15:timelineStyles defaultTimelineStyle=""TimeSlicerStyleLight1"" xmlns:x15="""" />")

Yes, it is Angular with VB. I am editing the XlsDataContractSerializerOutputFormatter.vb file as shown in the error and changing it to the code you recommend. After editing, each time I try to run the app in the developer environment, the code has reverted back and the error is still present. I have also tried to edit the project file with the same result.

You should add the file in the application ignore list as per our documentation:

Thank you, that fixed the issue.

FYI, the sample here is still using the old code