To export a gridview to Excel, the reponse content type can be changed to "application/vnd.xls" and then rendered using gridName.RenderControl. Is there any reason this same approach cannot/should not be taken for rendering a listview out to word?
Is there another preferred method for exporting a listview to word?
UPDATE: I have verified that this will work with Word; however, when opening the file, Word displays the html tags (along with the content) from the listview. Below is the code.
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=test.doc");
Response.Charset = "";
Response.ContentType = "application/msword";
var stringWriter = new StringWriter();
var htmlWriter = new HtmlTextWriter(stringWriter);
listView.RenderControl(htmlWriter);
Response.Write(stringWriter.ToString());
Response.End();