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)); } }
/// <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); }
/// <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)); }
internal static string GetContentType(EmbeddedControlPersistenceBinaryDataPartType controlType) => controlType switch {
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("controlType"); } }