Good morning,
i am using HTML Editor to generate html text, i got image in html as
<img src="./image.jpg" />
when convert html to word, image does not send to word in this way.
there is any way to send it to word by using this relative image path not by using full URL of website.
thanks and best regards,
Hi Sam,
Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. Its mean that if you convert your html to Word document using MS Word, you will get the same output.
Please make sure that the path of image is correct. Moreover, please use
LoadOptions.BaseUri property to get/set the string that will be used to resolve relative URIs found in the document into absolute URIs when required.
If you still face problem, please share your input html and image here for testing. We will investigate the issue on our side and provide you more information.
Hi Manzoor,
Dim html As String = "Test html" & Literal1.Text & ""
Dim htmlBytes As Byte() = Encoding.UTF8.GetBytes(html)
Dim htmlStream As New MemoryStream(htmlBytes)
dim doc As New Document(htmlStream, New LoadOptions(LoadFormat.Html, "", "http://localhost:50718/"))
Dim docStream As MemoryStream = New MemoryStream()
doc.Save(docStream, Aspose.Words.SaveFormat.Docx)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=test.docx")
Dim bytes() As Byte = docStream.ToArray()
HttpContext.Current.Response.BinaryWrite(bytes)
HttpContext.Current.Response.End()
Thanks for your cooperation and best regards,
Hi Sam,
Thanks for your inquiry. Could you please confirm if your problem is solved?
If you still face the issue, we need your input html and images here for investigation purposes.
Hi Manzoor,
it's solved by previous code.
Thanks for your cooperation,
Best regards,