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

Move blocks between documents

2 Answers 181 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
Maksymilian
Top achievements
Rank 1
Maksymilian asked on 21 Jun 2018, 12:20 PM

Hi,

I'm trying to move individual blocks (BlockBase) from one document to another (RadFlowDocument). Unfortunately I get an error saying that the blocks I try to move are still related to their original document. This makes sense, because when creating a new block (both Paragraphs and Tables) you must pass a related document to the constructor. Same goes for all their children like Runs, Breaks, Rows etc.

Therefore my question - how can I copy a BlockBase from one RadFlowDocument to another? Is there a way to change this document relationship to another document?

Thanks in advance

Maks

2 Answers, 1 is accepted

Sort by
0
Accepted
Boby
Telerik team
answered on 25 Jun 2018, 07:20 AM
Hi Maksymilian,

For basic scenarios, you can use cloning, as described in the Clone and Merge documentation article. For more advanced importing of document elements, you can go with DocumentElementImporter. The main difference is that the latter handles styles, lists and other related properties of the document elements.

Regards,
Boby
Progress Telerik

0
Maksymilian
Top achievements
Rank 1
answered on 25 Jun 2018, 11:07 AM

Hi Boby,

thank you for your answer! Works like a charm, exactly what I was looking for.

Brgds

Maks

Tags
WordsProcessing
Asked by
Maksymilian
Top achievements
Rank 1
Answers by
Boby
Telerik team
Maksymilian
Top achievements
Rank 1
Share this question
or