示例#1
0
        /// <summary>
        /// Renders the report using the requested presentation type.
        /// </summary>
        /// <param name="sg">IStreamGen for generating result stream</param>
        /// <param name="type">Presentation type: HTML, XML, PDF, MHT, or ASP compatible HTML</param>
        /// <param name="prefix">For HTML puts prefix allowing unique name generation</param>
        public void RunRender(IStreamGen sg, OutputPresentationType type, string prefix)
        {
            if (sg == null)
            {
                throw new ArgumentException("IStreamGen argument cannot be null.", "sg");
            }
            RenderHtml rh = null;

            PageNumber = 1;                     // reset page numbers
            TotalPages = 1;
            IPresent        ip;
            MemoryStreamGen msg = null;

            switch (type)
            {
            case OutputPresentationType.PDF:
                ip = new RenderPdf(this, sg);
                _Report.Run(ip);
                break;

            case OutputPresentationType.XML:
                if (_Report.DataTransform != null && _Report.DataTransform.Length > 0)
                {
                    msg = new MemoryStreamGen();
                    ip  = new RenderXml(this, msg);
                    _Report.Run(ip);
                    RunRenderXmlTransform(sg, msg);
                }
                else
                {
                    ip = new RenderXml(this, sg);
                    _Report.Run(ip);
                }
                break;

            case OutputPresentationType.MHTML:
                this.RunRenderMht(sg);
                break;

            case OutputPresentationType.ASPHTML:
            case OutputPresentationType.HTML:
            default:
                ip        = rh = new RenderHtml(this, sg);
                rh.Asp    = (type == OutputPresentationType.ASPHTML);
                rh.Prefix = prefix;
                _Report.Run(ip);
                // Retain the CSS and JavaScript
                if (rh != null)
                {
                    _CSS        = rh.CSS;
                    _JavaScript = rh.JavaScript;
                }
                break;
            }

            sg.CloseMainStream();
            _Cache = new RCache();
            return;
        }
示例#2
0
        /// <summary>
        /// Renders the report using the requested presentation type.
        /// </summary>
        /// <param name="sg">IStreamGen for generating result stream</param>
        /// <param name="type">Presentation type: HTML, XML, PDF, MHT, or ASP compatible HTML</param>
        /// <param name="prefix">For HTML puts prefix allowing unique name generation</param>
        public void RunRender(IStreamGen sg, OutputPresentationType type, string prefix)
        {
            if (sg == null)
                throw new ArgumentException("IStreamGen argument cannot be null.", "sg");
            RenderHtml rh=null;

            PageNumber = 1;		// reset page numbers
            TotalPages = 1;
            IPresent ip;
            MemoryStreamGen msg = null;
            switch (type)
            {
                case OutputPresentationType.PDF:
                    ip = new RenderPdf(this, sg);
                    _Report.Run(ip);
                    break;
                case OutputPresentationType.PDFOldStyle:
                    ip = new RenderPdf(this, sg);
                    this.ItextPDF = false;
                    _Report.Run(ip);
                    break;
                case OutputPresentationType.TIF:
                    ip = new RenderTif(this, sg);
                    _Report.Run(ip);
                    break;
                case OutputPresentationType.TIFBW:
                    RenderTif rtif = new RenderTif(this, sg);
                    rtif.RenderColor = false;
                    ip = rtif;
                    _Report.Run(ip);
                    break;
                case OutputPresentationType.XML:
                    if (_Report.DataTransform != null && _Report.DataTransform.Length > 0)
                    {
                        msg = new MemoryStreamGen();
                        ip = new RenderXml(this, msg);
                        _Report.Run(ip);
                        RunRenderXmlTransform(sg, msg);
                    }
                    else
                    {
                        ip = new RenderXml(this, sg);
                        _Report.Run(ip);
                    }
                    break;
                case OutputPresentationType.MHTML:
                    this.RunRenderMht(sg);
                    break;
                case OutputPresentationType.CSV:
                    ip = new RenderCsv(this, sg);
                    _Report.Run(ip);
                    break;
                case OutputPresentationType.RTF:
                    ip = new RenderRtf(this, sg);
                    _Report.Run(ip);
                    break;
                case OutputPresentationType.Excel:
                    ip = new RenderExcel(this, sg);
                    _Report.Run(ip);
                    break;
                case OutputPresentationType.ASPHTML:
                case OutputPresentationType.HTML:
                default:
                    ip = rh = new RenderHtml(this, sg);
                    rh.Asp = (type == OutputPresentationType.ASPHTML);
                    rh.Prefix = prefix;
                    _Report.Run(ip);
                    // Retain the CSS and JavaScript
                    if (rh != null)
                    {
                        _CSS = rh.CSS;
                        _JavaScript = rh.JavaScript;
                    }
                    break;
            }

            sg.CloseMainStream();
            _Cache = new RCache();
            return;
        }
示例#3
0
		// Renders the report; RunGetData must be run before this.
		public void RunRender(IStreamGen sg, OutputPresentationType type)
		{
			if (sg == null)
				throw new ArgumentException("IStreamGen argument cannot be null.", "sg");

			PageNumber.RuntimePageNumber = 1;		// reset page numbers
			TotalPages.RuntimePageCount = 1;
			IPresent ip;
			MemoryStreamGen msg = null;
			switch (type)
			{
				case OutputPresentationType.PDF:
					ip = new RenderPdf(this, sg);
					break;
				case OutputPresentationType.XML:
					if (this.DataTransform != null && DataTransform.Length > 0)
					{
						msg = new MemoryStreamGen();
						ip = new RenderXml(this, msg);
					}
					else
						ip = new RenderXml(this, sg);    
					break;
				case OutputPresentationType.HTML:
				default:
					ip = new RenderHtml(this, sg);
					break;
			}
			Run(ip);

			// When msg isn't null we have to do a datatransform on the XML in the data stream
			if (msg != null)
			{
				try
				{
					string file;
					if (this.DataTransform[0] != Path.DirectorySeparatorChar)
						file = this.Folder + Path.DirectorySeparatorChar + _DataTransform;
					else
						file = this.Folder + _DataTransform;
					XmlUtil.XslTrans(file, msg.GetText(), sg.GetStream());
				}	
				catch (Exception ex)
				{
					this.rl.LogError(8, "Error processing DataTransform " + ex.Message + "\r\n" + ex.StackTrace);
				}
				finally 
				{
					msg.Dispose();
				}
			}

			sg.CloseMainStream();

			return;
		}
示例#4
0
        /// <summary>
        /// Renders the report using the requested presentation type.
        /// </summary>
        /// <param name="sg">IStreamGen for generating result stream</param>
        /// <param name="type">Presentation type: HTML, XML, PDF, MHT, or ASP compatible HTML</param>
        /// <param name="prefix">For HTML puts prefix allowing unique name generation</param>
        public void RunRender(IStreamGen sg, OutputPresentationType type, string prefix)
        {
            if (sg == null)
            {
                throw new ArgumentException("IStreamGen argument cannot be null.", "sg");
            }

            //RenderHtml rh=null;

            PageNumber = 1;                     // reset page numbers
            TotalPages = 1;
            IPresent        ip;
            MemoryStreamGen msg = null;

            switch (type)
            {
            case OutputPresentationType.PDF:
                ip = new RenderPdf(this, sg);
                _Report.Run(ip);
                break;

            case OutputPresentationType.PDFOldStyle:
                ip            = new RenderPdf(this, sg);
                this.ItextPDF = false;
                _Report.Run(ip);
                break;

            //case OutputPresentationType.TIF:
            //    ip = new RenderTif(this, sg);
            //    _Report.Run(ip);
            //    break;
            //case OutputPresentationType.TIFBW:
            //    RenderTif rtif = new RenderTif(this, sg);
            //    rtif.RenderColor = false;
            //    ip = rtif;
            //    _Report.Run(ip);
            //    break;
            case OutputPresentationType.XML:
                if (_Report.DataTransform != null && _Report.DataTransform.Length > 0)
                {
                    msg = new MemoryStreamGen();
                    ip  = new RenderXml(this, msg);
                    _Report.Run(ip);
                    RunRenderXmlTransform(sg, msg);
                }
                else
                {
                    ip = new RenderXml(this, sg);
                    _Report.Run(ip);
                }
                break;

            case OutputPresentationType.MHTML:
                this.RunRenderMht(sg);
                break;

            case OutputPresentationType.CSV:
                ip = new RenderCsv(this, sg);
                _Report.Run(ip);
                break;

            case OutputPresentationType.RTF:
                ip = new RenderRtf(this, sg);
                _Report.Run(ip);
                break;
                //case OutputPresentationType.Excel:
                //    ip = new RenderExcel(this, sg);
                //    _Report.Run(ip);
                //    break;
                //case OutputPresentationType.ASPHTML:
                //case OutputPresentationType.HTML:
                //default:
                //    ip = rh = new RenderHtml(this, sg);
                //    rh.Asp = (type == OutputPresentationType.ASPHTML);
                //    rh.Prefix = prefix;
                //    _Report.Run(ip);
                //    // Retain the CSS and JavaScript
                //    if (rh != null)
                //    {
                //        _CSS = rh.CSS;
                //        _JavaScript = rh.JavaScript;
                //    }
                //    break;
            }

            sg.CloseMainStream();
            _Cache = new RCache();
            return;
        }
示例#5
0
        /// <summary>
        /// Renders the report using the requested presentation type.
        /// </summary>
        /// <param name="sg">IStreamGen for generating result stream</param>
        /// <param name="type">Presentation type: HTML, XML, PDF, MHT, or ASP compatible HTML</param>
        /// <param name="prefix">For HTML puts prefix allowing unique name generation</param>
        public void RunRender(IStreamGen sg, OutputPresentationType type, string prefix, Pages pgs)
        {
            if (sg == null)
            {
                throw new ArgumentException("IStreamGen argument cannot be null.", "sg");
            }
            RenderHtml rh = null;


            PageNumber = 1;             // reset page numbers
            TotalPages = 1;
            IPresent        ip;
            MemoryStreamGen msg = null;

            switch (type)
            {
            case OutputPresentationType.PDF:
            case OutputPresentationType.RenderPdf_iTextSharp:
                ip = new RenderPdf_iTextSharp(this, sg);
                _Report.Run(ip);
                break;

            case OutputPresentationType.PDFOldStyle:
                ip            = new RenderPdf(this, sg);
                this.ItextPDF = false;
                _Report.Run(ip);
                break;

            case OutputPresentationType.TIF:
                ip = new RenderTif(this, sg);
                _Report.Run(ip);
                break;

            case OutputPresentationType.TIFBW:
                RenderTif rtif = new RenderTif(this, sg);
                rtif.RenderColor = false;
                ip = rtif;
                _Report.Run(ip);
                break;

            case OutputPresentationType.XML:
                if (_Report.DataTransform != null && _Report.DataTransform.Length > 0)
                {
                    msg = new MemoryStreamGen();
                    ip  = new RenderXml(this, msg);
                    _Report.Run(ip);
                    RunRenderXmlTransform(sg, msg);
                }
                else
                {
                    ip = new RenderXml(this, sg);
                    _Report.Run(ip);
                }
                break;

            case OutputPresentationType.MHTML:
                this.RunRenderMht(sg, pgs);
                break;

            case OutputPresentationType.CSV:
                ip = new RenderCsv(this, sg);
                _Report.Run(ip);
                break;

            case OutputPresentationType.RTF:
                ip = new RenderRtf(this, sg);
                _Report.Run(ip);
                break;

            case OutputPresentationType.Excel:
                ip = new RenderExcel(this, sg);
                _Report.Run(ip);
                break;

            case OutputPresentationType.ASPHTML:
            case OutputPresentationType.HTML:
            default:
                ip        = rh = new RenderHtml(this, sg);
                rh.Asp    = (type == OutputPresentationType.ASPHTML);
                rh.Prefix = prefix;
                _Report.Run(ip);
                // Retain the CSS and JavaScript
                if (rh != null)
                {
                    _CSS        = rh.CSS;
                    _JavaScript = rh.JavaScript;
                }
                break;
            }

            sg.CloseMainStream();
            _Cache = new RCache();
            return;
            ////if (this.ItextPDF)
            ////    ip = new RenderPdf_iTextSharp(this, sg);
            ////else
            //    switch (type)
            //    {
            //        case OutputPresentationType.PDF:
            //        case OutputPresentationType.RenderPdf_iTextSharp:
            //            ip = new RenderPdf_iTextSharp(this, sg);
            //            RunRender(ref ip, ref pgs);
            //            break;
            //        case OutputPresentationType.PDFOldStyle:
            //            ip = new RenderPdf(this, sg);
            //            this.ItextPDF = false;
            //            RunRender(ref ip, ref pgs);
            //            break;
            //        case OutputPresentationType.TIF:
            //            ip = new RenderTif(this, sg);
            //            RunRender(ref ip, ref pgs);
            //            break;
            //        case OutputPresentationType.TIFBW:
            //            RenderTif rtif = new RenderTif(this, sg);
            //            rtif.RenderColor = false;
            //            ip = rtif;
            //            RunRender(ref ip, ref pgs);
            //            break;
            //        case OutputPresentationType.XML:
            //            if (_Report.DataTransform != null && _Report.DataTransform.Length > 0)
            //            {
            //                var msg = new MemoryStreamGen();
            //                ip = new RenderXml(this, msg);
            //                RunRender(ref ip, ref pgs);
            //                RunRenderXmlTransform(sg, msg);
            //            }
            //            else
            //            {
            //                ip = new RenderXml(this, sg);
            //                RunRender(ref ip, ref pgs);
            //            }
            //            break;
            //        case OutputPresentationType.MHTML:
            //            this.RunRenderMht(sg,pgs);
            //            break;
            //        case OutputPresentationType.CSV:
            //            ip = new RenderCsv(this, sg);
            //            RunRender(ref ip, ref pgs);
            //            break;
            //        case OutputPresentationType.RTF:
            //            ip = new RenderRtf(this, sg);
            //            RunRender(ref ip, ref pgs);
            //            break;
            //        case OutputPresentationType.Excel:
            //            ip = new RenderExcel(this, sg);
            //            RunRender(ref ip, ref pgs);
            //            break;
            //        case OutputPresentationType.ASPHTML:
            //        case OutputPresentationType.HTML:
            //        default:
            //            ip = rh = new RenderHtml(this, sg);
            //            rh.Asp = (type == OutputPresentationType.ASPHTML);
            //            rh.Prefix = prefix;
            //            RunRender(ref ip, ref pgs);
            //            // Retain the CSS and JavaScript
            //            if (rh != null)
            //            {
            //                _CSS = rh.CSS;
            //                _JavaScript = rh.JavaScript;
            //            }
            //            break;
            //    }

            //pgs.CleanUp();      // always want to make sure we cleanup to reduce resource usage
            //_Cache = new RCache();

            //return;



            //         PageNumber = 1;		// reset page numbers
            //TotalPages = 1;
            //IPresent ip;
            //MemoryStreamGen msg = null;
            //switch (type)
            //{
            //             case OutputPresentationType.PDF:
            //             case OutputPresentationType.RenderPdf_iTextSharp:
            //                 ip =new RenderPdf_iTextSharp(this, sg);
            //                 _Report.Run(ip);
            //                 break;
            //             case OutputPresentationType.PDFOldStyle:
            //                 ip = new RenderPdf(this, sg);
            //                 this.ItextPDF = false;
            //                 _Report.Run(ip);
            //                 break;
            //             case OutputPresentationType.TIF:
            //                 ip = new RenderTif(this, sg);
            //                 _Report.Run(ip);
            //                 break;
            //             case OutputPresentationType.TIFBW:
            //                 RenderTif rtif = new RenderTif(this, sg);
            //                 rtif.RenderColor = false;
            //                 ip = rtif;
            //                 _Report.Run(ip);
            //                 break;
            //             case OutputPresentationType.XML:
            //		if (_Report.DataTransform != null && _Report.DataTransform.Length > 0)
            //		{
            //			msg = new MemoryStreamGen();
            //			ip = new RenderXml(this, msg);
            //			_Report.Run(ip);
            //			RunRenderXmlTransform(sg, msg);
            //		}
            //		else
            //		{
            //			ip = new RenderXml(this, sg);
            //			_Report.Run(ip);
            //		}
            //		break;
            //	case OutputPresentationType.MHTML:
            //		this.RunRenderMht(sg);
            //		break;
            //             case OutputPresentationType.CSV:
            //                 ip = new RenderCsv(this, sg);
            //                 _Report.Run(ip);
            //                 break;
            //             case OutputPresentationType.RTF:
            //                 ip = new RenderRtf(this, sg);
            //                 _Report.Run(ip);
            //                 break;
            //             case OutputPresentationType.Excel:
            //                 ip = new RenderExcel(this, sg);
            //                 _Report.Run(ip);
            //                 break;
            //             case OutputPresentationType.ASPHTML:
            //	case OutputPresentationType.HTML:
            //	default:
            //		ip = rh = new RenderHtml(this, sg);
            //		rh.Asp = (type == OutputPresentationType.ASPHTML);
            //		rh.Prefix = prefix;
            //		_Report.Run(ip);
            //		// Retain the CSS and JavaScript
            //		if (rh != null)
            //		{
            //			_CSS = rh.CSS;
            //			_JavaScript = rh.JavaScript;
            //		}
            //		break;
            //}

            //sg.CloseMainStream();
            //         _Cache = new RCache();
            //         return;
        }
示例#6
0
        // Renders the report; RunGetData must be run before this.
        public void RunRender(IStreamGen sg, OutputPresentationType type)
        {
            if (sg == null)
            {
                throw new ArgumentException("IStreamGen argument cannot be null.", "sg");
            }

            PageNumber.RuntimePageNumber = 1;                           // reset page numbers
            TotalPages.RuntimePageCount  = 1;
            IPresent        ip;
            MemoryStreamGen msg = null;

            switch (type)
            {
            case OutputPresentationType.PDF:
                ip = new RenderPdf(this, sg);
                break;

            case OutputPresentationType.XML:
                if (this.DataTransform != null && DataTransform.Length > 0)
                {
                    msg = new MemoryStreamGen();
                    ip  = new RenderXml(this, msg);
                }
                else
                {
                    ip = new RenderXml(this, sg);
                }
                break;

            case OutputPresentationType.HTML:
            default:
                ip = new RenderHtml(this, sg);
                break;
            }
            Run(ip);

            // When msg isn't null we have to do a datatransform on the XML in the data stream
            if (msg != null)
            {
                try
                {
                    string file;
                    if (this.DataTransform[0] != Path.DirectorySeparatorChar)
                    {
                        file = this.Folder + Path.DirectorySeparatorChar + _DataTransform;
                    }
                    else
                    {
                        file = this.Folder + _DataTransform;
                    }
                    XmlUtil.XslTrans(file, msg.GetText(), sg.GetStream());
                }
                catch (Exception ex)
                {
                    this.rl.LogError(8, "Error processing DataTransform " + ex.Message + "\r\n" + ex.StackTrace);
                }
                finally
                {
                    msg.Dispose();
                }
            }

            sg.CloseMainStream();

            return;
        }