Novacode.Paragraph.GetOrGenerateRel C# (CSharp) Method

GetOrGenerateRel() private method

private GetOrGenerateRel ( Novacode.Hyperlink h ) : string
h Novacode.Hyperlink
return string
        internal string GetOrGenerateRel(Hyperlink h)
        {
            string image_uri_string = h.Uri.OriginalString;

            // Search for a relationship with a TargetUri that points at this Image.
            var Id =
            (
                from r in mainPart.GetRelationshipsByType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")
                where r.TargetUri.OriginalString == image_uri_string
                select r.Id
            ).SingleOrDefault();

            // If such a relation dosen't exist, create one.
            if (Id == null)
            {
                // Check to see if a relationship for this Picture exists and create it if not.
                PackageRelationship pr = mainPart.CreateRelationship(h.Uri, TargetMode.External, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink");
                Id = pr.Id;
            }
            return Id;
        }

Same methods

Paragraph::GetOrGenerateRel ( Picture p ) : string