Hi,
I am having issue converting HTML to Word. I have attached the HTML which I need to convert and Word file which I get as output.
Also, here’s my code :
string sHtml = sw.ToString();
Document doc = new Document();
//Once the builder is created, its cursor is positioned at the beginning of the document.
DocumentBuilder builder = new DocumentBuilder(doc);
builder.PageSetup.Orientation = Aspose.Words.Orientation.Landscape;
builder.PageSetup.TopMargin = 5;
builder.PageSetup.LeftMargin = 8;
builder.PageSetup.BottomMargin = 5;
builder.PageSetup.RightMargin = 8;
builder.InsertHtml(sHtml);
Hi Amit,
Thanks for your inquiry. I have attached a DOCX document, that is generated by using Aspose.Words v11.8.0 on my side, here for your reference. If you view this document in Web Layout in MS WORD, the output looks pretty good. Could you please highlight the problematic areas and attach the screen shots for our reference. I will investigate the issue(s) on my side and provide you more information.
Best Regards,
Hi,
In web layout its look good., but in Normal Layout whole document is a problem. You can notice it urself by switching it to normal mode and back to web layout.
Hi Amit,
Thanks for your inquiry. Yes, you’re right; but, this is because ‘Web Layout View’ shows how your document will look as a Web page. Similarly, ‘Print Layout View’ shows how your document will look once it is printed. I see this is the expected behaviour of MS WORD. If we can help you with anything else, please feel free to ask.
Best Regards,
Hi,
I understand what you say. In weblayout it would look alright. But what I expect from Aspose when it says “HTML to Word conversion” is that it would convert HTML to native word format which is not just normally viewable in WebLayout but also in Normal Layout. If in Normal layout whole layout goes for a toss, whats the use of converting, our clients cannot use it.
There must be something which can help me. I will appreciate, if you try to look deeper into the problem.
Thanks,
Hi Amit,
Thanks for the additional information. May be you should use the following code snippet to make sure your output Word document is always opened in Web Layout mode in Microsoft Word.
doc.ViewOptions.ViewType = ViewType.Web;
If we can help you with anything else, please feel free to ask.
Best Regards,
We resolved the issue ourself.
I am sorry to say, but we were really disappointed with the help you provided. Knowing your framework, you should have resolved this issue instantly. We provided you with raw html to test, but despite that you did not take up the matter too seriously to investigate and resolve.
Thanks for your help anyway. I hope this is not the case when we purchase the framework.
Hi Amit,
Thanks for your feedback. It is perfect that you managed to achieve what you’re looking for. Moreover, I would suggest you please read the following articles on features supported on importing HTML into Aspose.Words’ DOM and exporting Word documents to HTML format:
If we can help you with anything else, please feel free to ask.
Best Regards,