Exemplo n.º 1
0
        public Relationship AddImageToTree(string uniqueId, Stream data, string extension, string relationshipType, string locationHint, string parentLocation, ContentTypeAction ctypeAction)
        {
            bool         newBlob;
            Relationship relationship = _relationshipTree.AddImageToTree(uniqueId, extension, relationshipType, locationHint, parentLocation, ctypeAction, out newBlob);

            if (newBlob)
            {
                Stream stream = ((IStreambookModel)_workbookmodel).ZipPackage.GetPart(new Uri(Utils.CleanName(relationship.RelatedPart), UriKind.Relative)).GetStream();
                SupportClass.CopyStream(data, stream);
            }
            return(relationship);
        }
Exemplo n.º 2
0
        public Relationship AddImageToTree(string uniqueId, Stream data, string extension, string relationshipType, string locationHint, string parentLocation, ContentTypeAction ctypeAction)
        {
            bool         flag         = default(bool);
            Relationship relationship = this._relationshipTree.AddImageToTree(uniqueId, extension, relationshipType, locationHint, parentLocation, ctypeAction, out flag);

            if (flag)
            {
                Package     zipPackage = ((IStreambookModel)this._workbookmodel).ZipPackage;
                PackagePart part       = zipPackage.GetPart(new Uri(Utils.CleanName(relationship.RelatedPart), UriKind.Relative));
                Stream      stream     = part.GetStream();
                SupportClass.CopyStream(data, stream);
            }
            return(relationship);
        }