I’m using builder.inserthtml to insert html containing a reference to a jpg file that will not display.
The following code:
Builder.MoveToBookmark("bmkRemarks")
html = FileIO.FileSystem.ReadAllText(Path_String & Rational_File_Name & ".htm")
'Insert HTML at bookamrk
Builder.InsertHtml(html)
Hello!
Thank you for considering Aspose.
When you insert an image link with InsertHtml, Aspose.Words tries to read or download the image and add its data to the document model. If you see a red cross this means the image was inaccessible at the time of insertion. Let’s think why the image could not be read.
Since you are specifying relative path like src=“PermImages/SSME_PW_DARPW0397R0A0.jpg” the image should be located relatively to the document itself. I. e. in the same folder with the current document should be a subfolder named “PermImages” with the file inside.
When you create the document from scratch there is no location information and Aspose.Words won’t find the image. To fix this you can insert an HTML snippet with “base” element before you insert any images:
Another way of specifying base path is constructing a document from stream with additional parameter for base path: https://reference.aspose.com/words/net/aspose.words/document/
Please let us know whether this helps in your case.
Regards,