将报告副本保存到计算机 [英] saving a report copy to the computer
问题描述
我正在开发Windows窗体应用程序,但在报告"部分遇到了麻烦.我使用报表查看器设计了报表,所有工作均正常进行,但是我想在报表作为附件打开给客户时自动发送一份副本,我不知道如何,请帮忙...
Hi, im developing a windows form application and having trouble under the reports section. i used Report viewer to design my reports, everything works perfectly but I want to automaticaly send a copy of the report when it opens to the customer as an attachment and I don''t know how, please help...
推荐答案
我找到了解决方案:)
I found the solution :)
using System.IO;
using System.Data.Sql;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;
警告[]警告;
string [] streamids;
字符串mimeType;
字符串编码;
字符串扩展名;
byte []个字节= reportViewer1.LocalReport.Render("PDF",null,out mimeType,out编码,out扩展名,out streamids,out警告);
FileStream fs = new FileStream(@"D:\ Report" + sales_code +".pdf",FileMode.Create);
fs.Write(bytes,0,bytes.Length);
fs.Close();
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
byte[] bytes = reportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
FileStream fs = new FileStream(@"D:\Report" + sales_code + ".pdf", FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
这篇关于将报告副本保存到计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!