c# - How to find word hyperlink with OpenXML -


am trying fetch hyperlinks address word document every paragraph using openxml.

public static string getaddressfrompara(paragraph paras) {     ienumerable<hyperlink> hplk = paras.descendants<hyperlink>();     if (hplk != null)     {         foreach (hyperlink hp in hplk)         {             //string address = ???????;         }     } } 

i believe should

foreach (hyperlink hp in hplk) {     hyperlinktext = new stringbuilder();     foreach (text text in hp.descendants<text>())         hyperlinktext.append(text.innertext);      hyperlinkrelationshipid = hp.id.value;       externalrelationship hyperlinkrelationship = doc         .maindocumentpart         .externalrelationships         .single(c => c.id == hyperlinkrelationshipid);      hyperlinkuri = new stringbuilder(hyperlinkrelationship.uri.absoluteuri); } 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -