We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image links validation similar to hyperlinks

Hi,

I referred to this link - http://www.aspose.com/docs/display/wordsnet/How+to++Replace+or+Modify+Hyperlinks for validating hyperlinks that comes in anchor tag. I want to do the same for image src links too. Any suggestions? Thanks.


Hi,


Thanks for your inquiry. Perhaps, you can use Shape.HRef property to get or set the full hyperlink address for a shape. However, could you please attach your input Word document containing ‘image src link’ here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

After converting the attached word doc using aspose to html; I see there is a way to validate the anchor href tag - http://www.aspose.com/docs/display/wordsnet/How+to++Replace+or+Modify+Hyperlinks.



I want to do similar validation for src value too (in this case check if “img_src.001.jpeg” is valid).

Hi,


Thanks for your inquiry. Please try using the following code:

Document doc = new Document(MyDir + @“img_src.docx”);

HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.Html);

options.PrettyFormat = true;

options.ImageSavingCallback = new HandleImageSaving();

doc.Save(MyDir + @"15.9.0.html", options);


public class HandleImageSaving : IImageSavingCallback

{

void IImageSavingCallback.ImageSaving(ImageSavingArgs e)

{

if (e.ImageFileName.EndsWith(".jpeg"))

e.ImageFileName = e.ImageFileName.Replace("15.9.0.001.jpeg", "new.jpeg");

}

}


Hope, this helps.

Best regards,