Hello, I am developing a webform, which when submitted emails the form and/or fields as word attachment. To generate the web form as word document I have used below lines:
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter);StreamWriter objStreamWriter = File.AppendText(strFilepath);
Panel1.RenderControl(oHtmlTextWriter);
objStreamWriter.WriteLine(oStringWriter.ToString());
objStreamWriter.Close();
Using smtpdotnet, I am emailing this word attachment. The problem is that the word document generated does not look straight. Fields are not properly aligned and margins are messed up with the result that the print-out does not even print the entire document. Can you suggest if there is a better approach to the solution above to render a clean-looking word document? Would you recommend any third party tools or components for ASP.NET 2.0? Any help is appreciated. Thanks.