public POIXMLProperties(OPCPackage docPackage)
        {
            this.pkg  = docPackage;
            this.core = new POIXMLProperties.CoreProperties((PackagePropertiesPart)this.pkg.GetPackageProperties());
            PackageRelationshipCollection relationshipsByType1 = this.pkg.GetRelationshipsByType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties");

            if (relationshipsByType1.Size == 1)
            {
                this.extPart = this.pkg.GetPart(relationshipsByType1.GetRelationship(0));
                this.ext     = new POIXMLProperties.ExtendedProperties(ExtendedPropertiesDocument.Parse(this.extPart.GetInputStream()));
            }
            else
            {
                this.extPart = (PackagePart)null;
                this.ext     = new POIXMLProperties.ExtendedProperties(POIXMLProperties.NEW_EXT_INSTANCE.Copy());
            }
            PackageRelationshipCollection relationshipsByType2 = this.pkg.GetRelationshipsByType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties");

            if (relationshipsByType2.Size == 1)
            {
                this.custPart = this.pkg.GetPart(relationshipsByType2.GetRelationship(0));
                this.cust     = new POIXMLProperties.CustomProperties(CustomPropertiesDocument.Parse(this.custPart.GetInputStream()));
            }
            else
            {
                this.custPart = (PackagePart)null;
                this.cust     = new POIXMLProperties.CustomProperties(POIXMLProperties.NEW_CUST_INSTANCE.Copy());
            }
        }
        static POIXMLProperties()
        {
            NEW_EXT_INSTANCE = new ExtendedPropertiesDocument();
            NEW_EXT_INSTANCE.AddNewProperties();

            NEW_CUST_INSTANCE = new CustomPropertiesDocument();
            NEW_CUST_INSTANCE.AddNewProperties();
        }
        public POIXMLProperties(OPCPackage docPackage)
        {
            this.pkg = docPackage;

            // Core properties
            core = new CoreProperties((PackagePropertiesPart)pkg.GetPackageProperties());

            // Extended properties
            PackageRelationshipCollection extRel =
                pkg.GetRelationshipsByType(PackageRelationshipTypes.EXTENDED_PROPERTIES);

            if (extRel.Size == 1)
            {
                extPart = pkg.GetPart(extRel.GetRelationship(0));
                ExtendedPropertiesDocument props = ExtendedPropertiesDocument.Parse(
                    extPart.GetInputStream()
                    );
                ext = new ExtendedProperties(props);
            }
            else
            {
                extPart = null;
                ext     = new ExtendedProperties((ExtendedPropertiesDocument)NEW_EXT_INSTANCE.Copy());
            }

            // Custom properties
            PackageRelationshipCollection custRel =
                pkg.GetRelationshipsByType(PackageRelationshipTypes.CUSTOM_PROPERTIES);

            if (custRel.Size == 1)
            {
                custPart = pkg.GetPart(custRel.GetRelationship(0));
                CustomPropertiesDocument props = CustomPropertiesDocument.Parse(
                    custPart.GetInputStream()
                    );
                cust = new CustomProperties(props);
            }
            else
            {
                custPart = null;
                cust     = new CustomProperties((CustomPropertiesDocument)NEW_CUST_INSTANCE.Copy());
            }
        }
 internal ExtendedProperties(ExtendedPropertiesDocument props)
 {
     this.props = props;
 }