Free Support Forum - aspose.com

Presale question

I see that I can import HTML into a word document. Does it convert the HTML to the document format? Or is it embeded HTML?

Can I export a section of a word document to HTML?

Can this be ran in a Windows Service Environment?


This message was posted using Aspose.Live 2 Forum

Hi

Thanks for your inquiries.

1. You can convert HTML documents to Word document using the following code.

Document doc = new Document(@"in.html");

doc.Save("out.doc", SaveFormat.Doc);

2. You can insert html into the document using Document builder. For example

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertHtml("Bold text");

doc.Save("out.doc");

3. You can extract part of document and convert it to HTML. See the following example.

Document srcDoc = new Document("in.doc");

Document dstDoc = new Document();

Section newSect = dstDoc.ImportNode(srcDoc.Sections[0], true, ImportFormatMode.KeepSourceFormatting);

dstDoc.Sections.Add(newSect);

dstDoc.Save("out.html", SaveFormat.Html);

4. Yes, you can do that in a Windows Service Environment

Please let me know if you would like to know anything else, I will be happy to help you.

Best regards.