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

Free Support Forum - aspose.com

Problem when get Image

I just retrive the image from database and print in document using buider.insertImage().

If there is no image it throw error…

How can i display in image cell [“no images available”] when there is no image in database or wrong path…?


Thanks for your inquiry. You can use File.Exists Method (String) to determine whether the specified image file exists.

Document doc = new Document(MyDir + @"in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
if (File.Exists(MyDir + "Aspose.Words.jpg"))
    builder.InsertImage(MyDir + "Aspose.Words.jpg");
    builder.Write("no images available");
doc.Save(MyDir + @"17.2.0.docx");

Hope, this helps.

Best regards,

Thank you so much…