export gridview to word and save file without user interaction

advertisements

I am exporting a gridview to ms word. This I accomplished successfully, but I don't want to show the users the MS word prompt that ask the users to open the file or save the file on the hard drive. I just want the gridview to be exported to word and saved on the c:\ drive without any user interaction so once the user presses the export button, the gridview gets exported to ms word and the word file gets saved to the hard drive.

any help will be greatly appreciated.


I'm not sure if that is possible since users C:\ drive is not the same as your C:\ drive. There might be some security implication since you are saving to users root directory, but to answer your question try to use IO fileStream which save the document as *.doc extension.

Try this from MSDN