/// <summary> /// Adds a CustomPropertyPart to the WorksheetPart /// </summary> /// <param name="partType">The part type of the CustomPropertyPart</param> /// <return>The newly added part</return> public CustomPropertyPart AddCustomPropertyPart(CustomPropertyPartType partType) { var contentType = CustomPropertyPartTypeInfo.GetContentType(partType); var partExtension = CustomPropertyPartTypeInfo.GetTargetExtension(partType); OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension); return(AddCustomPropertyPart(contentType)); }
internal static string GetTargetExtension(CustomPropertyPartType partType) { switch (partType) { case CustomPropertyPartType.Spreadsheet: return(".xml"); case CustomPropertyPartType.Xml: return(".xml"); default: return(".xml"); } }
internal static string GetContentType(CustomPropertyPartType partType) { switch (partType) { case CustomPropertyPartType.Spreadsheet: return("application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty"); case CustomPropertyPartType.Xml: return("application/xml"); default: throw new ArgumentOutOfRangeException(nameof(partType)); } }
/// <summary> /// Adds a CustomPropertyPart to the WorksheetPart. /// </summary> /// <param name="partType">The part type of the CustomPropertyPart.</param> /// <param name="id">The relationship id.</param> /// <returns>The newly added part.</returns> public CustomPropertyPart AddCustomPropertyPart(CustomPropertyPartType partType, string id) { string contentType = CustomPropertyPartTypeInfo.GetContentType(partType); string partExtension = CustomPropertyPartTypeInfo.GetTargetExtension(partType); OpenXmlPackage.PartExtensionProvider.MakeSurePartExtensionExist(contentType, partExtension); return AddCustomPropertyPart(contentType, id); }
internal static string GetTargetExtension(CustomPropertyPartType partType) { switch (partType) { case CustomPropertyPartType.Spreadsheet: return ".xml"; case CustomPropertyPartType.Xml: return ".xml"; default: return ".xml"; } }
internal static string GetContentType(CustomPropertyPartType partType) { switch (partType) { case CustomPropertyPartType.Spreadsheet: return "application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty"; case CustomPropertyPartType.Xml: return "application/xml"; default: throw new ArgumentOutOfRangeException("partType"); } }
internal static string GetContentType(CustomPropertyPartType partType) => partType switch {