一键导出并通过电子邮件发送excel [英] Export and Email excel in one click

查看:119
本文介绍了一键导出并通过电子邮件发送excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个报告,其中我已启用了导出到excel的功能,是否可以直接通过电子邮件将导出的excel文件作为附件发送,而无需手动选择特定文件.

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.

推荐答案

使用以下代码:

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

是您的excel对象.

is your excel object.


这篇关于一键导出并通过电子邮件发送excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆