Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I'm using WPF, VB.net. 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.
Posted
Comments
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.Add()
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.ExportAsFixedFormat("C:\Users\Admin\Desktop\Doc112.pdf")

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

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