1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| public byte[] Generate(string reportPath, ReportDataSourceCollection sources, OutputFormat format)
{
LocalReport localReport = new LocalReport();
localReport.ReportPath = reportPath;
foreach (ReportDataSource source in sources.Values)
localReport.DataSources.Add(source);
Warning[] warnings;
string[] streamids;
string mimeType;
string deviceInfo = "<DeviceInfo><StartPage>0</StartPage></DeviceInfo>";
string encoding;
string extension;
string outFormat;
switch (format)
{
case OutputFormat.Pdf:
outFormat = "PDF";
break;
case OutputFormat.Excel:
outFormat = "Excel";
break;
default:
outFormat = "PDF";
break;
}
return localReport.Render(
outFormat, deviceInfo, out mimeType, out encoding,
out extension, out streamids, out warnings);
} |