I use SQL Report server to generate XLS report. Server returns the result as byte array. I create a MemoryStreamfrom the byte array like this:
MemoryStream stream = new MemoryStream(byteArray);
I add this stream as attachment but I cannot open the attachment in the generated email. Excel says the file is corrupted.
Without an example file I can say nothing about this... please post an example MSG file or if you don't want to post it here then sent it to sicos2002@hotmail.com ... please ZIP the file before sending it.
I use SQL Report server to generate XLS report. Server returns the result as byte array. I create a
MemoryStream
from the byte array like this:MemoryStream stream = new MemoryStream(byteArray);
I add this stream as attachment but I cannot open the attachment in the generated email. Excel says the file is corrupted.
email.Attachments.Add(attachment.Stream, attachment.FileName);
The report result is valid, if I write it into a file then Excel can open the file without any issue.