How to Export asp.net page to ms word

Hi

Please send me code sample for exporting asp.net page to ms word . I am using C# . I don’t want store word at application path . It should be ask save path or save folder option like Response.Contenttype .

I have preview pages . In preview page we have images also. I have to convert that preview page to ms word . I am ready to buy aspose.word convertion tool but beforely I am testing on free trail once ok then i’ll buy.

Its very urjent to me kindly please send code.

We are using office 2003 and office 2007 . That code should be compatable with to both these. I saw in aspose documentation its possible but i am unable get sample code . Please send.

Thanks & Regards
Mallikarjuna rao
Totalebizsolutions
Singapore
malli.a@totalebizsolutons.com

Hi

Thanks for your interest in Aspose.Words. You can try using the following code.

string url = "http://localhost/mysite/default.aspx";
//Prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "application/msword";
request.UserAgent = "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0";
//Execute the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
//We will read data via the response stream
Stream resStream = response.GetResponseStream();
//Write content into the MemoryStream
BinaryReader resReader = new BinaryReader(resStream);
MemoryStream docStream = new MemoryStream(resReader.ReadBytes((int)response.ContentLength));
//Create document
Document doc = new Document(docStream);
//Save document
doc.Save(@"Test138\out.doc");

Also note Aspose.Words does not require having Microsoft Word installed, as Aspose.Words itself is a Word document creation engine.

Best regards.