Empty Shape.HRef property (Aspose.Words 4.0 beta)



an issue is Shape.HRef property always returns empty string for shapes positioned inline with the text. Even if URL adress of appropriate image is defined in the .doc file. On the other hand Shape.HRef of floating object seems to be OK.




Inline images never have HRef property set. Instead, their URL is defined in the enclosing hyperlink field. That is how it was designed in MS Word. Try using the following method to retrieve the inline image URL:

private string GetInlineImageHref(Shape shape)


string href = shape.PreviousSibling.PreviousSibling.GetText();

return Regex.Match(href, @"\"".*?\""").Value.Trim(new char[] {'\"', ' '});


Best regards,


Thanks for pointing this out. Before the final release is out we will try to unify hyperlinks for inline shapes so they appear as Href property, not as a hyperlink field. We’ve already unified a lot of behaviour between inline and floating shapes. The goal for us is to make difference between them only in the positioning type, nothing else.