Mark Barto's Blog
Technical Blog about the Microsoft .NET Platform and everything that surrounds it such as .Net, C#, BizTalk, WCF, ASP.NET, SQL, Silverlight, IIS ...Aspose.Words: Image file cannot be written to disk when using external images
I have a .docx template and have defined some mail merge fields and included an image from the web as link included. When I'm trying to save the document as output for HTML I'm getting the following error:
Image file cannot be written to disk. When saving the document to a stream either Images Folder should be specified or custom streams should be provided via ImageSavingCallback.
This is a bit of strange behavior when using a link to an image which resides on the web because it should not have to save it to disk ? Why must the image be saved to disk when in the .docx template the image linked to a http address because you can use as SRC in the IMG tag this address when converting to HTML ?
The solution after talked to my colleague he pointed me to use the option Link to File when inserting external images.
You can click on the arrow after the insert button and it will have three options:
- Insert
- Link to file
- Insert and link
The first selection Insert will insert the image and embed it in the document, the second selection Link to file will link to the external address as image and will not embed the image. The third and last option Insert and link will link to the external and also embed the image.
Leave a comment