Esempio n. 1
0
        public EmbeddedControlPersistencePart AddEmbeddedControlPersistencePart(EmbeddedControlPersistencePartType partType)
        {
            var contentType   = EmbeddedControlPersistencePartTypeInfo.GetContentType(partType);
            var partExtension = EmbeddedControlPersistencePartTypeInfo.GetTargetExtension(partType);

            OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension);
            return(AddEmbeddedControlPersistencePart(contentType));
        }
        internal static string GetTargetExtension(EmbeddedControlPersistencePartType controlType)
        {
            switch (controlType)
            {
            case EmbeddedControlPersistencePartType.ActiveX:
                return(".xml");

            case EmbeddedControlPersistencePartType.ActiveXBin:
                return(".bin");

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

            case EmbeddedControlPersistencePartType.ActiveXBin:
                return("application/vnd.ms-office.activeX");

            default:
                throw new ArgumentOutOfRangeException(nameof(controlType));
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Adds a EmbeddedControlPersistencePart to the WorksheetPart.
 /// </summary>
 /// <param name="partType">The part type of the EmbeddedControlPersistencePart.</param>
 /// <param name="id">The relationship id.</param>
 /// <returns>The newly added part.</returns>
  public EmbeddedControlPersistencePart AddEmbeddedControlPersistencePart(EmbeddedControlPersistencePartType partType, string id)
 {
     string contentType = EmbeddedControlPersistencePartTypeInfo.GetContentType(partType);
     string partExtension = EmbeddedControlPersistencePartTypeInfo.GetTargetExtension(partType);
     OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension);
 
     return AddEmbeddedControlPersistencePart(contentType, id);
 }
Esempio n. 5
0
 internal static string GetContentType(EmbeddedControlPersistencePartType controlType)
 => controlType switch
 {
Esempio n. 6
0
        internal static string GetTargetExtension(EmbeddedControlPersistencePartType controlType)
        {
            switch (controlType)
            {
                case EmbeddedControlPersistencePartType.ActiveX:
                    return ".xml";

                case EmbeddedControlPersistencePartType.ActiveXBin:
                    return ".bin";

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

                case EmbeddedControlPersistencePartType.ActiveXBin:
                    return "application/vnd.ms-office.activeX";

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