I need to achieve the same behavior as shown above using C# code. All I have is a set of HTML files in my file system which should be added as objects to an existing Microsoft Word, so that the end user could open the HTML file(s) by clicking the icon.
Below is the code I tried which failed to upload the HTML file as an icon that links to the HTML file. Instead, it just inserted the HTML content in Word which is not expected.
All I need is to achieve the steps mentioned in below url programatically using C# code.
Insert Object in MS word manually
Microsoft.Office.Interop.Word.Application winword = new Microsoft.Office.Interop.Word.Application(); object missing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.Document document = winword.Documents.Add(ref missing, ref missing, ref missing, ref missing); Microsoft.Office.Interop.Word.Paragraph paragraph = document.Content.Paragraphs.Add(ref missing); paragraph.Range.InsertFile("C:\\Documentum\\CompContent7.html", ref missing, ref missing, ref missing, true); object filename = "C:\\end_result_document.docx"; document.SaveAs(ref filename);