Nevron Forum

Iterate Hyperlinks/Images in the Document

https://www.nevron.com/Forum/Topic10657.aspx

By Clint Carter - Wednesday, April 6, 2016

How do you iterate/find all images in a document?
I want to find and delete them...

I need to find all hyperlinks inside the document.
I need to get the URL from each hyperlink.

How is this done? 



By Nevron Support - Thursday, April 7, 2016

Hi Clint,

The following code collects all images found in a text document:
NList<NNode> imageInlines = richTextView.Content.GetDescendants(NImageInline.NImageInline);
similarly for hyperlinks the code is:
NList<NNode> hyperlinkInlines = richTextView.Content.GetDescendants(NHyperlink.NHyperlinkSchema);

Regarding the hyperlink url:
NHyperlinkInline hyperlinkInline = (NHyperlinkInline)hyperlinks[0];
string url = (hyperlinkInline.Hyperlink as NUrlHyperlink).Url;

Hope this helps - let us know if you meet any problems.

By Clint Carter - Friday, April 8, 2016

Thanks.