8using System.Collections.Generic;
17 internal class PackagePartDefinition
24 internal const int WORKBOOK_PACKAGE_PART_INDEX = 0;
28 internal const int METADATA_PACKAGE_PART_START_INDEX = 1000;
32 internal const int WORKSHEET_PACKAGE_PART_START_INDEX = 10000;
36 internal const int POST_WORSHEET_PACKAGE_PART_START_INDEX = 2000000;
43 internal enum PackagePartType
63 public DocumentPath Path {
get;
private set; }
67 public PackagePartType PartType {
get;
private set; }
71 public int OrderNumber {
get;
private set; }
75 public string ContentType {
get;
private set; }
79 public string RelationshipType {
get;
private set; }
90 public PackagePartDefinition(PackagePartType type,
int orderNumber,
string fileNameInPackage,
string pathInPackage,
string contentType,
string relationshipType)
91 : this(type, orderNumber, new DocumentPath(fileNameInPackage, pathInPackage), contentType, relationshipType)
102 internal PackagePartDefinition(PackagePartType type,
int orderNumber, DocumentPath documentPath,
string contentType,
string relationshipType)
104 this.PartType = type;
105 this.OrderNumber = orderNumber;
106 this.Path = documentPath;
107 this.ContentType = contentType;
108 this.RelationshipType = relationshipType;
116 internal int GetWorksheetIndex()
118 return this.OrderNumber - WORKSHEET_PACKAGE_PART_START_INDEX;
126 internal static List<PackagePartDefinition> Sort(List<PackagePartDefinition> packagePartDefinitions)
128 return packagePartDefinitions.OrderBy(p => p.OrderNumber).ToList();