private Report GetReport(string reportSource) { // Now parse the file RDLParser rdlp; Report r; rdlp = new RDLParser(reportSource); rdlp.Folder = WorkingDirectory; rdlp.OverwriteConnectionString = connectionString; rdlp.OverwriteInSubreport = overwriteSubreportConnection; // RDLParser takes RDL XML and Parse compiles the report r = rdlp.Parse(); if (r.ErrorMaxSeverity > 0) { foreach (string emsg in r.ErrorItems) { Console.WriteLine(emsg); } SetErrorMessages(r.ErrorItems); int severity = r.ErrorMaxSeverity; r.ErrorReset(); if (severity > 4) { errorsAction.Active = true; return(null); // don't return when severe errors } } return(r); }
private Report GetReport(string prog, string file) { // Now parse the file RDLParser rdlp; Report r; try { rdlp = new RDLParser(prog); string folder = Path.GetDirectoryName(file); if (folder == "") { folder = Environment.CurrentDirectory; } rdlp.Folder = folder; r = rdlp.Parse(); if (r.ErrorMaxSeverity > 4) { MessageBox.Show(string.Format("Report {0} has errors and cannot be processed.", "Report")); r = null; // don't return when severe errors } } catch (Exception e) { r = null; MessageBox.Show(e.Message, "Report load failed"); } return(r); }
private Report GetReport(string reportSource) { // Now parse the file RDLParser rdlp; Report r; rdlp = new RDLParser(reportSource); // RDLParser takes RDL XML and Parse compiles the report r = rdlp.Parse(); if (r.ErrorMaxSeverity > 0) { foreach (string emsg in r.ErrorItems) { Console.WriteLine(emsg); } int severity = r.ErrorMaxSeverity; r.ErrorReset(); if (severity > 4) { r = null; // don't return when severe errors } } return(r); }
private Report GetReportFromFileOrMemory(ReportInfo reportInfo) { RDLParser rdlp; Report r; string source; if (reportInfo.Source == null) { source = System.IO.File.ReadAllText(reportInfo.GetPath()); } else { source = reportInfo.Source; } rdlp = new RDLParser(source) { Folder = System.IO.Path.GetDirectoryName(reportInfo.GetPath()), OverwriteConnectionString = reportInfo.ConnectionString, OverwriteInSubreport = true }; r = rdlp.Parse(); return(r); }
private Report GetReport(string prog, string file) { // Now parse the file RDLParser rdlp; Report r; try { rdlp = new RDLParser(prog); string folder = Path.GetDirectoryName(file); if (folder == "") { folder = Environment.CurrentDirectory; } rdlp.Folder = folder; r = rdlp.Parse(); if (r.ErrorMaxSeverity > 4) { MessageBox.Show(Strings.DrillParametersDialog_ShowC_ReportHasErrors); r = null; // don't return when severe errors } } catch (Exception e) { r = null; MessageBox.Show(e.Message, Strings.DrillParametersDialog_Show_ReportLoadFailed); } return(r); }
public static Report GetReport(Uri uri2Rdl) { //string cwd = System.Environment.CurrentDirectory; //var rdlView = new fyiReporting.RdlViewer.RdlViewer(); //rdlView.SourceFile = new Uri(System.IO.Path.Combine(cwd,"Reports", "FunctionTest.rdl")); string filePath = uri2Rdl.LocalPath; // Now parse the file string source = System.IO.File.ReadAllText(filePath); RDLParser rdlp; Report r; rdlp = new RDLParser(source); // RDLParser takes RDL XML and Parse compiles the report r = rdlp.Parse(); if (r.ErrorMaxSeverity > 0) { foreach (string emsg in r.ErrorItems) { // Console.WriteLine(emsg); } int severity = r.ErrorMaxSeverity; r.ErrorReset(); if (severity > 4) { r = null; // don't return when severe errors } } return(r); }
private Report GetReport(string templateName, List <Param> paramList) { var sqlParams = paramList.Where(p => p.Type == ParamType.SQL).ToList(); var source = File.ReadAllText(GetReportFileName(templateName)); var rdlp = new RDLParser(source) { Folder = Path.Combine(RootFolder, TemplateFolder) }; return(rdlp.Parse(sqlParams)); }
private Report GetReport(string prog, string file) { // Now parse the file RDLParser rdlp; Report r; try { // Make sure RdlEngine is configed before we ever parse a program // The config file must exist in the Bin directory. //string searchDir = this.MapPathSecure(this.ReportFile.StartsWith("~") ? "~/Bin" : "/Bin") + Path.DirectorySeparatorChar; string searchDir = this.MapPathSecure("~/Bin") + Path.DirectorySeparatorChar; RdlEngineConfig.RdlEngineConfigInit(searchDir); rdlp = new RDLParser(prog); string folder = Path.GetDirectoryName(file); if (folder == "") { folder = Environment.CurrentDirectory; } rdlp.Folder = folder; rdlp.DataSourceReferencePassword = new NeedPassword(this.GetPassword); r = rdlp.Parse(); if (r.ErrorMaxSeverity > 0) { AddError(r.ErrorMaxSeverity, r.ErrorItems); if (r.ErrorMaxSeverity >= 8) { r = null; } r.ErrorReset(); } // If we've loaded the report; we should tell it where it got loaded from if (r != null) { r.Folder = folder; r.Name = Path.GetFileNameWithoutExtension(file); r.GetDataSourceReferencePassword = new RDL.NeedPassword(GetPassword); } } catch (Exception e) { r = null; AddError(8, "Exception parsing report {0}. {1}", file, e.Message); } return(r); }
private Report GetReport(string prog, string file) { // Now parse the file RDLParser rdlp; Report r; try { rdlp = new RDLParser(prog); string folder = Path.GetDirectoryName(file); if (folder == "") { folder = Environment.CurrentDirectory; } rdlp.Folder = folder; rdlp.DataSourceReferencePassword = new NeedPassword(this.GetPassword); r = rdlp.Parse(); if (r.ErrorMaxSeverity > 0) { // have errors fill out the msgs Console.WriteLine("{0} has the following errors:", file); foreach (string emsg in r.ErrorItems) { Console.WriteLine(emsg); // output message to console } int severity = r.ErrorMaxSeverity; r.ErrorReset(); if (severity > 4) { r = null; // don't return when severe errors returnCode = 8; } } // If we've loaded the report; we should tell it where it got loaded from if (r != null) { r.Folder = folder; r.Name = Path.GetFileNameWithoutExtension(file); r.GetDataSourceReferencePassword = new RDL.NeedPassword(GetPassword); } } catch (Exception e) { r = null; Console.WriteLine(e.Message); returnCode = 8; } return(r); }
private Report ProcessReportCompile(string file, string prog, out string msgs) { // Now parse the file RDLParser rdlp; Report r; msgs = ""; try { rdlp = new RDLParser(prog); rdlp.Folder = Path.GetDirectoryName(file); rdlp.DataSourceReferencePassword = new NeedPassword(this.GetPassword); r = rdlp.Parse(); if (r.ErrorMaxSeverity > 0) { // have errors fill out the msgs foreach (String emsg in r.ErrorItems) { if (_server.TraceLevel > 0) { Console.WriteLine(emsg); // output message to console } msgs += (emsg + "<p>"); } int severity = r.ErrorMaxSeverity; r.ErrorReset(); if (severity > 4) { r = null; // don't return when severe errors } } // If we've loaded the report; we should tell it where it got loaded from if (r != null) { r.Folder = Path.GetDirectoryName(file); r.Name = Path.GetFileNameWithoutExtension(file); r.GetDataSourceReferencePassword = new RDL.NeedPassword(GetPassword); } } catch (Exception ex) { msgs = string.Format("<H2>{0}</H2>", ex.Message); r = null; } return(r); }
public void PrepareReport() { RDLParser rdlp; var reportPath = ReportInfo.GetPath(); string source = ReportInfo.Source ?? System.IO.File.ReadAllText(reportPath); rdlp = new RDLParser(source); if (reportPath != null) { rdlp.Folder = System.IO.Path.GetDirectoryName(reportPath); } rdlp.OverwriteConnectionString = ReportInfo.ConnectionString; rdlp.OverwriteInSubreport = true; Report = rdlp.Parse(); Report.RunGetData(ReportInfo.Parameters); Pages = Report.BuildPages(); }
private static Report GetReport(string reportSource) { // Now parse the file RDLParser rdlp; Report r; rdlp = new RDLParser(reportSource); rdlp.Folder = workingDirectory; rdlp.OverwriteConnectionString = connectionString; rdlp.OverwriteInSubreport = overwriteSubreportConnection; // RDLParser takes RDL XML and Parse compiles the report r = rdlp.Parse(); if (r.ErrorMaxSeverity > 0) { foreach (string emsg in r.ErrorItems) { Console.WriteLine(emsg); } } return(r); }
public void Print(ReportInfo reportInfo) { var reportPath = reportInfo.GetPath(); var source = reportInfo.Source ?? File.ReadAllText(reportPath); var rdlParser = new RDLParser(source) { Folder = Path.GetDirectoryName(reportPath), OverwriteConnectionString = reportInfo.ConnectionString, OverwriteInSubreport = true }; var report = rdlParser.Parse(); report.RunGetData(reportInfo.Parameters); var pages = report.BuildPages(); switch (reportInfo.PrintType) { case ReportInfo.PrintingType.Default: var orientation = report.PageHeightPoints > report.PageWidthPoints ? PageOrientation.Portrait : PageOrientation.Landscape; var defaultPrintOperation = new DefaultPrintOperation(); defaultPrintOperation.Run(pages, orientation); break; case ReportInfo.PrintingType.MultiplePrinters: var multiplePrintOperation = new MultiplePrintOperation(_unitOfWorkFactory, _commonServices, _userPrintingRepository); multiplePrintOperation.Run(pages); break; default: throw new NotSupportedException($"{reportInfo.PrintType} is not supported"); } }
// Obtain the Pages by running the report private Report GetReport() { string prog; // Obtain the source if (_loadFailed) { prog = GetReportErrorMsg(); } else if (_SourceRdl != null) { prog = _SourceRdl; } else if (_SourceFileName != null) { prog = GetRdlSource(); } else { prog = GetReportEmptyMsg(); } // Compile the report // Now parse the file RDLParser rdlp; Report r; try { _errorMsgs = null; rdlp = new RDLParser(prog); rdlp.DataSourceReferencePassword = GetDataSourceReferencePassword; if (_SourceFileName != null) { rdlp.Folder = Path.GetDirectoryName(_SourceFileName); } else { rdlp.Folder = this.Folder; } r = rdlp.Parse(); if (r.ErrorMaxSeverity > 0) { _errorMsgs = r.ErrorItems; // keep a copy of the errors int severity = r.ErrorMaxSeverity; r.ErrorReset(); if (severity > 4) { r = null; // don't return when severe errors _loadFailed = true; } } // If we've loaded the report; we should tell it where it got loaded from if (r != null && !_loadFailed) { // Don't care much if this fails; and don't want to null out report if it does try { if (_SourceFileName != null) { r.Name = Path.GetFileNameWithoutExtension(_SourceFileName); r.Folder = Path.GetDirectoryName(_SourceFileName); } else { r.Folder = this.Folder; r.Name = this.ReportName; } } catch {} } } catch (Exception ex) { _loadFailed = true; _errorMsgs = new List <string>(); // create new error list _errorMsgs.Add(ex.Message); // put the message in it _errorMsgs.Add(ex.StackTrace); // and the stack trace r = null; } if (r != null) { _PageWidth = r.PageWidthPoints; _PageHeight = r.PageHeightPoints; _ReportDescription = r.Description; _ReportAuthor = r.Author; ParametersBuild(r); } else { _PageWidth = 0; _PageHeight = 0; _ReportDescription = null; _ReportAuthor = null; _ReportName = null; } return(r); }