Click here to Skip to main content
16,014,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a report in which i have enabled export to excel, is this is possible to directly email the exported excel file as an attachment without manually selecting the particular file.
Posted
Updated 10-Oct-12 0:30am
v2

1 solution

use the following code:

MemoryStream ms = new MemoryStream(stream.FileContents);  
// Create an in-memory System.IO.Stream 
 
ContentType ct = new ContentType(stream.ContentType); 
 
Attachement a = new Attachment(ms, ct); 



here
stream
is your excel object.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900