You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Based on my analysis, the Flat OPC and cloning features are "broken" since v3.0.1:
When creating a Flat OPC document, the resulting WordprocessingDocument instances no longer have the relationship parts.
Cloning a WordprocessingDocument created from a Flat OPC document or string throws an OpenXmlPackageException.
To Reproduce
To reproduce, have a look at the OpenXmlSdtTests repo that I created for this purpose. I have created several xUnit-based projects that test the same features for the following versions:
v2.19.0, where everything works as expected,
v3.0.0, where everything works as expected after having made the changes related to Package being obsolete,
v3.0.1, where the features are first broken, and
v3.1.1, where the features are still broken.
Observed behavior
Since v3.0.1, WordprocessingDocument instances created using WordprocessingDocument.FromFlatOpcString(xml) no longer have the relationship parts. Up to and including v3.0.0, those parts appeared.
Since v3.0.1, cloning a WordprocessingDocument instance created using WordprocessingDocument.FromFlatOpcString(xml) can no longer be cloned. Calling the Clone() method or its overloads will throw an error.
Expected behavior
Flat OPC documents are created correctly (as before).
WordprocessingDocument instances can be cloned (as before).
Desktop (please complete the following information):
OS: any (tested on macOS and Windows 11)
Office version: any
.NET Target: any (tested using .NET 8 and .NET Framework 4.7.2)
DocumentFormat.OpenXml Version: since v3.0.1
The text was updated successfully, but these errors were encountered:
I've tested some more, and found out the following:
The WordprocessingDocument.FromFlatOpcString() overloads produce WordprocessingDocument instances with different sets of package parts (at least based on what someWordprocessingDocument.GetPackage().GetParts() is showing):
WordprocessingDocument.FromFlatOpcString(string) produces a WordprocessingDocument instance for which streamDoc.GetPackage().GetParts()does not contain the relationship parts (as demonstrated by the previous tests).
WordprocessingDocument.FromFlatOpcString(string, Stream, bool) produces a WordprocessingDocument instance for which streamDoc.GetPackage().GetParts()contains the relationship parts.
There is a workaround that allows us to clone a WordprocessingDocument that was first created from a Flat OPC string (or XDocument). Have a look at the FromFlatOpcString(string, Stream, bool) method in V311Tests/WorkaroundTests.cs.
Describe the bug
Based on my analysis, the Flat OPC and cloning features are "broken" since v3.0.1:
WordprocessingDocument
instances no longer have the relationship parts.WordprocessingDocument
created from a Flat OPC document or string throws anOpenXmlPackageException
.To Reproduce
To reproduce, have a look at the OpenXmlSdtTests repo that I created for this purpose. I have created several xUnit-based projects that test the same features for the following versions:
Package
being obsolete,Observed behavior
WordprocessingDocument
instances created usingWordprocessingDocument.FromFlatOpcString(xml)
no longer have the relationship parts. Up to and including v3.0.0, those parts appeared.WordprocessingDocument
instance created usingWordprocessingDocument.FromFlatOpcString(xml)
can no longer be cloned. Calling theClone()
method or its overloads will throw an error.Expected behavior
WordprocessingDocument
instances can be cloned (as before).Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: