When using the Clone function from RadFlowDocument, the below exception is thrown :
[2022-10-07T13:06:32.329Z] Error: System.ArgumentException: The document element is associated with another document. (Parameter 'item')
at Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.VerifyDocumentElementOnInsert(T item)
at Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.AddClonedChildrenFrom(DocumentElementCollection`2 fromCollection, CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.Paragraph.CloneCore(CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.AddClonedChildrenFrom(DocumentElementCollection`2 fromCollection, CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.Footer.CloneCore(CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.HeadersFootersBase`1.CloneHeadersFootersFrom(HeadersFootersBase`1 headersFooters, CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.Section.ClonePropertiesAndHeadersFooters(CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.Section.CloneCore(CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.AddClonedChildrenFrom(DocumentElementCollection`2 fromCollection, CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.RadFlowDocument.CloneCore(CloneContext cloneContext)
at Telerik.Windows.Documents.Flow.Model.RadFlowDocument.Clone()
at Perspex.Shared.OOPGenerator.OOPGenerator.SetWordDocumentTemplate(Schools school, SchoolYear schoolyear) in D:\projecten\cip\Perspex\src\Perspex.Shared\OOPGenerator\OOPGenerator.cs:line 62
It occurs after I upgraded to the latest version (2022.3.906) of RAD Document processing. In the previous version it worked as expected.
Steps I take to reproduce the issue :
1) Load a word document
2) Clone the document.
Having a basic docx document with two tables and bookmarks generates an invalid word document when saving.
Steps to reproduce :
I have included a simple project to demonstrate the issue.
Version 2022.2.613 does not have the above issues.
One cannot build the source code for document processing.
Error Message: StyleCop.MSBuild.5.0.0\build\StyleCop.MSBuild.targets" was not found. Confirm that the expression in the Import declaration "..\Tools\StyleCop.MSBuild.5.0.0\build\StyleCop.MSBuild.targets" is correct, and that the file exists on disk.