110,968
社区成员
发帖
与我相关
我的任务
分享
static void Test()
{
LocalReport lr = new LocalReport();
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>Excel</OutputFormat>" +
"</DeviceInfo>";
lr.ReportPath = @"C:\My Reports\Monthly Sales.rdlc";
lr.DataSources.Add(new ReportDataSource("Sales", GetSalesData()));
string mimeType, encoding, extension;
string[] streams;
Warning[] warnings;
byte[] bytes = lr.Render(
"Excel",
deviceInfo,
out mimeType,
out encoding,
out extension,
out streams,
out warnings);
using (FileStream fs = new FileStream(@"c:\My Reports\Monthly Sales.xls", FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
fs.Close();
}
}