Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="dataTable"></param>
        /// <param name="reportModel"></param>
        public void PrintPushDataReport(string fileName, DataTable dataTable,
                                        ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
            if (dataTable == null)
            {
                throw new ArgumentNullException("dataTable");
            }
            AbstractRenderer renderer = null;

            try {
                IReportModel model = ReportEngine.ValidatePushModel(fileName);
                CheckForParameters(model, reportParameters);
                renderer = SetupPushDataRenderer(model, dataTable);
                ReportEngine.ReportToPrinter(renderer, model);
            } catch (Exception) {
                throw;
            }
        }
Example #2
0
        /// <summary>
        /// send a Standart (PullModel/FormSheet) Report to printer
        /// </summary>
        /// <param name="fileName">Path to ReportFile</param>
        /// <param name="renderTo">Type of renderer currently only "ToText" is implemented</param>
//		[Obsolete("use PrintStandardReport (fileName,null)")]
//		public void PrintStandardReport (string fileName) {
//			if (String.IsNullOrEmpty(fileName)) {
//				throw new ArgumentNullException("fileName");
//			}
//			PrintStandardReport (fileName,null);
//
//		}
//

        public void PrintStandardReport(string fileName, ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }

            AbstractRenderer renderer = null;

            try {
                IReportModel model = LoadReportModel(fileName);
//				if (this.connectionObject == null) {
//					this.connectionObject = ReportEngine.PrepareConnectionFromParameters (model.ReportSettings,reportParameters);
//				}
//
                ReportEngine.CheckForParameters(model, reportParameters);
                renderer = SetupStandardRenderer(model, reportParameters);
                ReportEngine.ReportToPrinter(renderer, model);
            } catch (Exception) {
                throw;
            }
        }