This is a migrated thread and some comments may be shown as answers.

Convert mailmerged RadDocument to RadFlowDocument

1 Answer 465 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
Philipp
Top achievements
Rank 1
Philipp asked on 04 Feb 2016, 05:13 PM

Hi,

 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?

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 09 Feb 2016, 08:56 AM
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.

Regards,
Todor
Telerik
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
Tags
WordsProcessing
Asked by
Philipp
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or