Document.Clone does not import .MailMerge.MappedDataFields into the new document

Hello there,

I am creating a new document using sourceDocument.Clone().
All is fine except that .MailMerge.MappedDataFields in source document are not imported in the new document.

Do I need to import them separately or is there any method that I can call on Source document to create its exact replica including Mapped Fields?

If I import them separetely, I have to do something like:

Document clonedDocument = objSourceDocument.Clone();
MappedDataFieldCollection mappedFields = objSourceDocument.MailMerge.MappedDataFields;
foreach(DictionaryEntry mappedField in mappedFields)
    clonedDocument.MailMerge.MappedDataFields.Add(mappedField.Key.ToString(), mappedField.Value.ToString());

Please guide.


Thanks for your inquiry. There is no way to copy all MappedDataFields. So you should use code, like you showed above.
Best regards.