I am converting html to docx using Microsoft.Office.Interop.Word. Also html have img tag. Converted docx files shows imges properly in server but in other machines images does't come.
After investigating i found that images in docx is not embedded as it shows image path of server.
Any help on this would be of great use.
Code is as follows :
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document wordDoc = new Microsoft.Office.Interop.Word.Document(); Object oMissing = System.Reflection.Missing.Value; //wordDoc = word.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing); word.Visible = false; //Object encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8; Object openType = Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatWebPages; Object filepath = documentPath; word.Documents.Open(FileName: filepath, ReadOnly: false, Format: openType); Object confirmconversion = System.Reflection.Missing.Value; Object readOnly = false; string htmlFileNameWithExtension = Path.GetFileName(documentPath); string htmlFileNameWithoutExtension = Path.GetFileNameWithoutExtension(documentPath); Object saveto = documentPath.Replace(htmlFileNameWithExtension, htmlFileNameWithoutExtension); Object oallowsubstitution = System.Reflection.Missing.Value; wordDoc = word.Documents.Open(ref filepath, ref confirmconversion, ref readOnly, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing); object fileFormat = WdSaveFormat.wdFormatDocumentDefault; wordDoc.SaveAs(ref saveto, ref fileFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oallowsubstitution, ref oMissing, ref oMissing); wordDoc.Close(ref oMissing, ref oMissing, ref oMissing); word.Quit(ref oMissing, ref oMissing, ref oMissing);