mailing excel file from C# windows application
-
Hi, I am automating excel from my windows application developed using C# and saving this file having the reports obtained through a query. Then I am mailing the excel file as an attachment through the application using the system.web.mail class provided by .net. Now the mail feature works fine but when the person receives the mail, and clicks on the excel attachment to open it, he gets the following error: "abc.xls" cannot be accessed. the file may-be read only or you may be trying to access a read-only location or the server on which the document is stored may not be responding. Please help me out. Thanks in advance, Aryan.
-
Hi, I am automating excel from my windows application developed using C# and saving this file having the reports obtained through a query. Then I am mailing the excel file as an attachment through the application using the system.web.mail class provided by .net. Now the mail feature works fine but when the person receives the mail, and clicks on the excel attachment to open it, he gets the following error: "abc.xls" cannot be accessed. the file may-be read only or you may be trying to access a read-only location or the server on which the document is stored may not be responding. Please help me out. Thanks in advance, Aryan.
The header on an Excel file contains a null early on, around 10 characters in. If you're sending the contents of a file as a string, it'll hit the null and consider that the end of the file and not send the rest. Take a look at the size of the received attachment: is it resonable? A completely empty Excel 2003 file is 13824 bytes, so if it's much less than that, this is probably what's happening. Post a code snippet of your attach and send call. You may be missing (or the framework may be missing) something to designate your attachment as binary. Stephan