Click here to Skip to main content
14,875,773 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

I'm using WPF, From one of my function, i will receive a html string, which i need to convert into MS word document. I have copied the string into clipboard and tried to paste it on word document. But it is displaying as a html string only. How can a convert or load html string as word document.
Richard MacCutchan 29-Nov-15 3:33am
You first need to parse the HTML and extract just the text.

1 solution

Dim msword As New Document
Dim app As New Word.Application
app.Visible = True
app.Documents.Open(FileName:="C:\Users\Admin\Desktop\MyHTML.html", ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
Format:=WdOpenFormat.wdOpenFormatAuto, XMLTransform:="")


msword.SaveAs("C:\Users\Admin\Desktop\Doc1.pdf", Word.WdSaveFormat.wdFormatPDF)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900