We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

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

Best regards.