Esempio n. 1
0
        /// <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));
            }
        }
Esempio n. 4
0
 /// <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);
 }
Esempio n. 5
0
        internal static string GetTargetExtension(CustomPropertyPartType partType)
        {
            switch (partType)
            {
                case CustomPropertyPartType.Spreadsheet:
                    return ".xml";

                case CustomPropertyPartType.Xml:
                    return ".xml";

                default:
                    return ".xml";
            }
        }
Esempio n. 6
0
        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");
            }
        }
Esempio n. 7
0
 internal static string GetContentType(CustomPropertyPartType partType)
 => partType switch
 {