将报告副本保存到计算机 [英] saving a report copy to the computer

查看:70
本文介绍了将报告副本保存到计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发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屋!

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