Jitender Kumar
Jitender Kumar

Reputation: 2587

How to generate word document having HTML as input from Novacode Docx

I need to generate word and pdf file from html data as input. For e.g if my html contains b tag then everything under the b tag should be generate bold. I am using iTextSharp to generate the pdf file and novacode docx to generate word file and I have achieved this functionality in generating the pdf file with the below code:

iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(doc);
hw.Parse(new StringReader(model.HTMLContent));

But I am not able to generate the word file from html data. Any help would be great!

If Docx does not provide any solution for this requirement then I want to know what are the other options available for this functionality. I want to know specially with these options do I need to have ms-office install on server or not? Or what type of doc file will these options generate I mean with doc extension or docx extension?

Upvotes: 0

Views: 1936

Answers (1)

ePezhman
ePezhman

Reputation: 4010

I tried to do something like this with word about a year ago, and I had no success, apparently docx files don't support showing html in them. I'd recommend to insert images and tables and other in the word not the exact html.

Upvotes: 2

Related Questions