internal static string GetTargetExtension(EmbeddedControlPersistenceBinaryDataPartType controlType)
        {
            switch (controlType)
            {
            case EmbeddedControlPersistenceBinaryDataPartType.ActiveXBin:
                return(".bin");

            default:
                return(".bin");
            }
        }
        internal static string GetContentType(EmbeddedControlPersistenceBinaryDataPartType controlType)
        {
            switch (controlType)
            {
            case EmbeddedControlPersistenceBinaryDataPartType.ActiveXBin:
                return("application/vnd.ms-office.activeX");

            default:
                throw new ArgumentOutOfRangeException(nameof(controlType));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Adds a EmbeddedControlPersistenceBinaryDataPart to the WorksheetPart.
 /// </summary>
 /// <param name="partType">The part type of the EmbeddedControlPersistenceBinaryDataPart.</param>
 /// <param name="id">The relationship id.</param>
 /// <returns>The newly added part.</returns>
  public EmbeddedControlPersistenceBinaryDataPart AddEmbeddedControlPersistenceBinaryDataPart(EmbeddedControlPersistenceBinaryDataPartType partType, string id)
 {
     string contentType = EmbeddedControlPersistenceBinaryDataPartTypeInfo.GetContentType(partType);
     string partExtension = EmbeddedControlPersistenceBinaryDataPartTypeInfo.GetTargetExtension(partType);
     OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension);
 
     return AddEmbeddedControlPersistenceBinaryDataPart(contentType, id);
 }
Esempio n. 4
0
        /// <summary>
        /// Adds a EmbeddedControlPersistenceBinaryDataPart to the SlideMasterPart
        /// </summary>
        /// <param name="partType">The part type of the EmbeddedControlPersistenceBinaryDataPart</param>
        /// <return>The newly added part</return>
        public EmbeddedControlPersistenceBinaryDataPart AddEmbeddedControlPersistenceBinaryDataPart(EmbeddedControlPersistenceBinaryDataPartType partType)
        {
            var contentType   = EmbeddedControlPersistenceBinaryDataPartTypeInfo.GetContentType(partType);
            var partExtension = EmbeddedControlPersistenceBinaryDataPartTypeInfo.GetTargetExtension(partType);

            OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension);
            return(AddEmbeddedControlPersistenceBinaryDataPart(contentType));
        }
Esempio n. 5
0
 internal static string GetContentType(EmbeddedControlPersistenceBinaryDataPartType controlType)
 => controlType switch
 {
Esempio n. 6
0
        internal static string GetTargetExtension(EmbeddedControlPersistenceBinaryDataPartType controlType)
        {
            switch (controlType)
            {
                case EmbeddedControlPersistenceBinaryDataPartType.ActiveXBin:
                    return ".bin";

                default:
                    return ".bin";
            }
        }
Esempio n. 7
0
        internal static string GetContentType(EmbeddedControlPersistenceBinaryDataPartType controlType)
        {
            switch (controlType)
            {
                case EmbeddedControlPersistenceBinaryDataPartType.ActiveXBin:
                    return "application/vnd.ms-office.activeX";

                default:
                    throw new ArgumentOutOfRangeException("controlType");
            }
        }