-1
處理Table'table2'時發生錯誤:程序集「AssemblyName.Context,Version = 1.0.0.0,Culture = neutral ,PublicKeyToken = null「不允許被ObjectDataSource組件使用。請將其包含在應用程序配置文件的Telerik.Reporting配置部分中的AssemblyReferences元素中。爲什麼從C#導出Telerik報表時,組件不允許被ObjectDataSource組件使用該組件#
我正在使用下面的代碼導出PDF報告。
public static System.IO.Stream GerRep(List<EquipmentSearchResult> list)
{
EquipmentExportReportT report = new EquipmentExportReportT();
report.ReportParameters["BaseLocationName"].Value = "MyTest";
//report.DataSource = list;
ReportProcessor reportProcessor = new ReportProcessor();
// set any deviceInfo settings if necessary
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource();
// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = typeof(EquipmentExportReportT).AssemblyQualifiedName;
RenderingResult result = reportProcessor.RenderReport("XLS", typeReportSource, deviceInfo);
string fileName = result.DocumentName + "." + result.Extension;
string path = System.IO.Path.GetTempPath();
string filePath = System.IO.Path.Combine(path, fileName);
using (FileStream fs = new FileStream(filePath, System.IO.FileMode.Create))
{
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
}
MemoryStream ms = new MemoryStream(result.DocumentBytes);
ms.Position = 0;
return ms;
}
是的,它的工作,thansk –
..................................... ........ :) –
謝謝...... :) –