Esempio n. 1
0
        /// <summary>
        /// Adds a MailMergeRecipientDataPart to the DocumentSettingsPart
        /// </summary>
        /// <param name="partType">The part type of the MailMergeRecipientDataPart</param>
        /// <return>The newly added part</return>
        public MailMergeRecipientDataPart AddMailMergeRecipientDataPart(MailMergeRecipientDataPartType partType)
        {
            var contentType   = MailMergeRecipientDataPartTypeInfo.GetContentType(partType);
            var partExtension = MailMergeRecipientDataPartTypeInfo.GetTargetExtension(partType);

            OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension);
            return(AddMailMergeRecipientDataPart(contentType));
        }
        internal static string GetContentType(MailMergeRecipientDataPartType mailMergeRecipientDataPartType)
        {
            switch (mailMergeRecipientDataPartType)
            {
            case MailMergeRecipientDataPartType.OpenXmlMailMergeRecipientData:
                return("application/vnd.openxmlformats-officedocument.wordprocessingml.mailMergeRecipientData+xml");

            case MailMergeRecipientDataPartType.MsWordMailMergeRecipientData:
                return("application/vnd.ms-word.mailMergeRecipientData+xml");

            default:
                throw new ArgumentOutOfRangeException(nameof(mailMergeRecipientDataPartType));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Adds a MailMergeRecipientDataPart to the DocumentSettingsPart.
 /// </summary>
 /// <param name="partType">The part type of the MailMergeRecipientDataPart.</param>
 /// <param name="id">The relationship id.</param>
 /// <returns>The newly added part.</returns>
  public MailMergeRecipientDataPart AddMailMergeRecipientDataPart(MailMergeRecipientDataPartType partType, string id)
 {
     string contentType = MailMergeRecipientDataPartTypeInfo.GetContentType(partType);
     string partExtension = MailMergeRecipientDataPartTypeInfo.GetTargetExtension(partType);
     OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension);
 
     return AddMailMergeRecipientDataPart(contentType, id);
 }
 internal static string GetTargetExtension(MailMergeRecipientDataPartType mailMergeRecipientDataPartType)
 {
     return(".xml");
 }
Esempio n. 5
0
 internal static string GetTargetExtension(MailMergeRecipientDataPartType mailMergeRecipientDataPartType)
 {
     return ".xml";
 }
Esempio n. 6
0
 internal static string GetContentType(MailMergeRecipientDataPartType mailMergeRecipientDataPartType)
 {
     switch (mailMergeRecipientDataPartType)
     {
         case MailMergeRecipientDataPartType.OpenXmlMailMergeRecipientData:
             return "application/vnd.openxmlformats-officedocument.wordprocessingml.mailMergeRecipientData+xml";
         case MailMergeRecipientDataPartType.MsWordMailMergeRecipientData:
             return "application/vnd.ms-word.mailMergeRecipientData+xml";
         default:
             throw new ArgumentOutOfRangeException("mailMergeRecipientDataPartType");
     }
 }
Esempio n. 7
0
 internal static string GetContentType(MailMergeRecipientDataPartType mailMergeRecipientDataPartType)
 => mailMergeRecipientDataPartType switch
 {