I have an Action that returns a FileStreamResult
.
return File(htmlStream, "application/msword", "myfile.doc");
The htmlStream content includes an image with base64 data as the source:
<img src='data:image/png;base64,my_base_64_data_goes_here' />
The image does not appear in the Word file.
Notes and findings:
- The HTML content appears fine in the browser
- It does not appear in the Word file (it appears as an 'X', as when the image isn't available).
- Clicking on the 'X' in the Word and select "Edit Alt Text" confirms that it has the correct data (data:image/png;base64,my_base_64_data_goes_here).
- I do not know the MIME type of the image represented by the base64 data. But it works in the browser as an image tag in an HTML page.
What can I do to get the Word document with the image?