LocalReport version cannot understand report in 2008 report definition schema

I'm trying to convert my report from rdl to rdlc to render to Word file by LocalReport. Every 2010 schema version reports work well except 2008 reports.

With 2008 reports, LocalReport just renders a no data file without any error or warning. When debug the project, I see that all the DataSets are added with correct name as DataSet definition in report file. And all DataSets have needed data.

I've tried not to add any DataSet to LocalReport.DataSources, but report just render successful with no data while with other working reports, it will throw exception "Cannot create a data reader for dataset '[a dataset name]'".

Here is my code:

LocalReport localReport = new LocalReport();
localReport.ReportPath = localReportPath;
localReport.SubreportProcessing += LocalReport_SubreportProcessing;

//Add datasource
foreach (var ds in report.ReportDataSets.Where(x => localReport.GetDataSourceNames().Contains(x.DataSetName)))
            localReport.DataSources.Add(new ReportDataSource(ds.DataSetName, ds.Data));

//Add parameters
List<Microsoft.Reporting.WinForms.ReportParameter> paramaterList = new List<Microsoft.Reporting.WinForms.ReportParameter>();
foreach (var parammeter in report.ReportParameters)
            Microsoft.Reporting.WinForms.ReportParameter param = new Microsoft.Reporting.WinForms.ReportParameter()
                Name = parammeter.Name
            param.Values.AddRange(parammeter.Value.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));

const string devInfo = @"<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>";
Microsoft.Reporting.WinForms.Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
var bytes = localReport.Render(format, devInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
var outputPath = Path.GetTempPath();

if (!Directory.Exists(outputPath))
 using (var fileStream = File.Create(outputPath + @"\" + report.ReportName + "." + extension, bytes.Length))
            fileStream.Write(bytes, 0, bytes.Length);

Has anyone met this before?

I'm totally not understand why? Please help me, I've been stuck on this for a week.

0 Comment



Captcha image