Convert mailmerged RadDocument to RadFlowDocument

2 posts, 0 answers
  1. Philipp
    Philipp avatar
    8 posts
    Member since:
    Feb 2016

    Posted 04 Feb 2016 Link to this post


     I try to do the following: 

    1. Load .docx document into the RichTextBox

    2. Let the user edit the document

    3. Perform MailMerge on the document

    4. Export the result as PDF witha compliance level PdfComplianceLevel.PdfA1B


    Only the WordsProcessing library supports the compliance level, so I need to convert the RadDocument to a RadFlowDocument.

    When I export the RadDocument from the RichTexBox back to .docx I somehow loose all the styles (See WordBefore.png, WordAfter.png).

    When I export the RadDocument to .rtf, it keeps the correct styles, but when I import it using the Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider, I get the following Exception:

    Message: The document element is already associated with a parent.
    Parametername: item
    StackTrace:   bei Telerik.Windows.Documents.Flow.Model.Collections.DocumentElementCollection`2.VerifyDocumentElementOnInsert(T item)
       bei Telerik.Windows.Documents.Core.Data.DocumentElementCollectionBase`2.Add(T item)
       bei Telerik.Windows.Documents.Flow.FormatProviders.Rtf.Import.RtfImportContext.AddInline(InlineBase inline)
       bei Telerik.Windows.Documents.Flow.FormatProviders.Rtf.Import.TagHandlers.GroupTagHandlers.BookmarkEndHandler(RtfGroup group, RtfImportContext context)
       bei Telerik.Windows.Documents.Flow.FormatProviders.Rtf.Import.RtfDocumentImporter.DoVisitGroup(RtfGroup group)
       bei Telerik.Windows.Documents.Flow.FormatProviders.Rtf.Import.RtfElementIteratorBase.VisitElement(RtfElement element, Boolean recursive)
       bei Telerik.Windows.Documents.Flow.FormatProviders.Rtf.Import.RtfElementIteratorBase.VisitGroupChildren(RtfGroup group, Boolean recursive)
       bei Telerik.Windows.Documents.Flow.FormatProviders.Rtf.Import.RtfDocumentImporter.ImportRoot(RtfGroup rtfGroup)
       bei Telerik.Windows.Documents.Flow.FormatProviders.Rtf.Import.RtfDocumentImporter.Import(Stream input)
       bei Telerik.Windows.Documents.Flow.FormatProviders.Rtf.RtfFormatProvider.ImportOverride(Stream input)
       bei Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Import(Stream input)

     Do you have any proposal for me how I can accomplish this?

  2. Todor
    Todor avatar
    168 posts

    Posted 09 Feb 2016 Link to this post

    Hello Philipp,

    Thank you for your interest in RadWordsProcessing.

    We have an item in our backlog for converting documents between RadDocument and RadFlowDocument and here is the related feedback item for which you could vote and subscribe in order to be notified about any related changes.

    Now about the experienced issues with the format providers - unfortunately, it is hard to say what might cause the formatting loss and where the problem is. It will be great if you can share with us a sample project where the problem can be reproduced. In this way, it will be much easier for us to find what might cause the issue and how to fix it.

    Looking forward to your reply.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top