public static Stream GetDataDynamicPdfStream(string rdlxFileName, int?aUId, string productReferenceId, string PdmRequestRegisterID, string dataSourceType, string mainReferenceID, string masterReferenceID) { string fullpath = DDSetup.ReorptSetup.ReportRootPath + @"\" + rdlxFileName; try { PdfRenderingExtension device = new PdfRenderingExtension(); ReportDefinition def = new ReportDefinition(new FileInfo(fullpath)); ChangDataSourceInRentime(def, dataSourceType); using (ReportRuntime runtime = new ReportRuntime(def)) { SetupReportParamter(runtime, aUId, productReferenceId, PdmRequestRegisterID, mainReferenceID, masterReferenceID); // FileStreamProvider aFileStreamProvider= new FileStreamProvider(new DirectoryInfo(@".\"), exportFieName); DataDynamics.Reports.Rendering.IO.MemoryStreamProvider memoryStreamProvider = new MemoryStreamProvider(); runtime.Render(device, memoryStreamProvider); var pInfo = memoryStreamProvider.GetPrimaryStream(); return(pInfo.OpenStream()); } // ReportRuntime runtime = new ReportRuntime(rdl); } catch (Exception ex) { string exStrt = ex.ToString(); return(null); } }
private static void ExportToExcelFile(string rdlxFileName, string exportFieName, string uid) { ExcelTransformationDevice device = new ExcelTransformationDevice(); ExcelTemplateGenerator template = new ExcelTemplateGenerator(); MemoryStream templateStream = new MemoryStream(); // rdlxFileName = DDSetup.ReorptSetup.ReportRootPath + @"\" + rdlxFileName; ReportDefinition def = new ReportDefinition(new FileInfo(rdlxFileName)); template.GenerateTemplate(def, templateStream); templateStream.Position = 0; device.TemplateStream = templateStream; ReportRuntime runtime = new ReportRuntime(def); DDSetup.SetupDDReportRuntimeParameter(runtime, uid); runtime.Render(device, new FileStreamProvider(new DirectoryInfo(@".\OutPutExcel"), exportFieName)); }