RunRender() public method

Renders the report using the requested presentation type.
public RunRender ( IStreamGen sg, OutputPresentationType type ) : void
sg IStreamGen IStreamGen for generating result stream
type OutputPresentationType Presentation type: HTML, XML, PDF, or ASP compatible HTML
return void
        // Run the report passing the parameter values and the output
        public void Run(IDictionary parms, OutputPresentationType type)
        {
            r.RunGetData(parms);

            r.RunRender(_sg, type);

            return;
        }
Example #2
0
        // Run the report passing the parameter values and the output
        public void Run(IDictionary parms, OutputPresentationType type)
        {
            r.RunGetData(parms);
            var pgs = r.BuildPages();

            r.RunRender(_sg, type, pgs);

            return;
        }
        /// <summary>
        /// Save the report to the output selected.
        /// </summary>
        /// <param name='report'>
        /// Report.
        /// </param>
        /// <param name='FileName'>
        /// File name.
        /// </param>
        private void ExportReport(Report report, string FileName, OutputPresentationType exportType)
        {
            OneFileStreamGen sg = null;

            try
            {
                sg = new OneFileStreamGen(FileName, true);
                report.RunRender(sg, exportType);
            }
            catch (Exception ex)
            {
                Gtk.MessageDialog m = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                              Gtk.ButtonsType.Ok, false,
                              ex.Message);

                m.Run();
                m.Destroy();
            }
            finally
            {
                if (sg != null)
                {
                    sg.CloseMainStream();
                }
            }
            return;
        }
Example #4
0
        /// <summary>
        /// Save the file.  The extension determines the type of file to save.
        /// </summary>
        /// <param name="FileName">Name of the file to be saved to.</param>
        /// <param name="ext">Type of file to save.  Should be "pdf", "xml", "html", mht.</param>
        private void SaveAs(Report report, string FileName, string type)
        {
            string ext = type.ToLower();
            OneFileStreamGen sg=null;
            try
            {
                if (ext == "tifb")
                    FileName = FileName.Substring(0, FileName.Length - 1);      // get rid of the 'b'
                sg = new OneFileStreamGen(FileName, true);	// overwrite with this name
                switch(ext)
                {
                    case "pdf":
                        if (this._StampInfo == null)
                            report.RunRender(sg, OutputPresentationType.PDF);
                        else
                            SaveAsPdf(report, sg);
                        break;
                    case "xml":
                        report.RunRender(sg, OutputPresentationType.XML);
                        break;
                    case "mht":
                        report.RunRender(sg, OutputPresentationType.MHTML);
                        break;
                    case "html": case "htm":
                        report.RunRender(sg, OutputPresentationType.HTML);
                        break;
                    case "csv":
                        report.RunRender(sg, OutputPresentationType.CSV);
                        break;
                    case "xlsx":
                        report.RunRender(sg, OutputPresentationType.Excel);
                        break;
                    case "rtf":
                        report.RunRender(sg, OutputPresentationType.RTF);
                        break;
                    case "tif": case "tiff":
                        report.RunRender(sg, OutputPresentationType.TIF);
                        break;
                    case "tifb":
                        report.RunRender(sg, OutputPresentationType.TIFBW);
                        break;
                    default:
                        Console.WriteLine("Unsupported file extension '{0}'.  Must be 'pdf', 'xml', 'mht', 'csv', 'xslx', 'rtf', 'tif', 'tifb' or 'html'", type);
                        returnCode = 8;
                        break;
                }
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
                returnCode = 8;
            }
            finally
            {
                if (sg != null)
                {
                    sg.CloseMainStream();
                }
            }

            if (report.ErrorMaxSeverity > 0)
            {
                // have errors fill out the msgs
                Console.WriteLine("{0} has the following runtime errors:", FileName);
                foreach (string emsg in report.ErrorItems)
                {
                    Console.WriteLine(emsg);		// output message to console
                }
                report.ErrorReset();
            }

            return;
        }
Example #5
0
        private void Generate(Report report)
        {
            MemoryStreamGen sg=null;
            try
            {
                sg = new MemoryStreamGen("ShowFile.aspx?type=", null, this.RenderType);

                report.RunRender(sg, _RenderType, this.UniqueID);
                _CSS = "";
                _JavaScript = "";
                switch (_RenderType)
                {
                    case OutputPresentationType.ASPHTML:
                    case OutputPresentationType.HTML:
                        _CSS = report.CSS;//.Replace("position: relative;", "position: absolute;");
                        _JavaScript = report.JavaScript;
                        _Html = sg.GetText();
                        break;
                    case OutputPresentationType.XML:
                        _Xml = sg.GetText();
                        break;
                    case OutputPresentationType.CSV:
                        _Csv = sg.GetText();
                        break;
                    case OutputPresentationType.PDF:
                    {
                        MemoryStream ms = sg.MemoryList[0] as MemoryStream;
                        _Object = ms.ToArray();
                        break;
                    }
                }

                // Now save off the other streams in the session context for later use
                IList strms = sg.MemoryList;
                IList names = sg.MemoryNames;
                for (int i=1; i < sg.MemoryList.Count; i++)	// we skip the first one
                {
                    string n = names[i] as string;
                    MemoryStream ms = strms[i] as MemoryStream;
                    Context.Session[n] = ms.ToArray();
                }

            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                if (sg != null)
                {
                    sg.CloseMainStream();
                }
            }

            if (report.ErrorMaxSeverity > 0)
            {
                AddError(report.ErrorMaxSeverity, report.ErrorItems);
                report.ErrorReset();
            }

            return;
        }
Example #6
0
		/// <summary>
		/// Save the file.  The extension determines the type of file to save.
		/// </summary>
		/// <param name="FileName">Name of the file to be saved to.</param>
		/// <param name="ext">Type of file to save.  Should be "pdf", "xml", "html", mht.</param>
		private void SaveAs(Report report, string FileName, string type)
		{
			string ext = type.ToLower();
			OneFileStreamGen sg=null;
			try
			{
				bool isOldPdf = false;
				if (System.Environment.OSVersion.Platform == PlatformID.Unix && type=="pdf" ) {

                    if (System.IO.Directory.Exists("/usr/share/fonts/truetype/msttcorefonts")==false)
                    {
						isOldPdf = true;
                    }
                   
                }



                if (ext == "tifb")
                    FileName = FileName.Substring(0, FileName.Length - 1);      // get rid of the 'b'
				sg = new OneFileStreamGen(FileName, true);	// overwrite with this name
				switch(ext)
				{
					case "pdf":	
						if (this._StampInfo == null)
						{
							if (isOldPdf)
							{
								report.RunRender(sg, OutputPresentationType.PDFOldStyle);
							}
							else
							{
								report.RunRender(sg, OutputPresentationType.PDF);
							}
								
						}
						else
							SaveAsPdf(report, sg);
						break;
					case "xml": 
						report.RunRender(sg, OutputPresentationType.XML);
						break;																  
					case "mht": 
						report.RunRender(sg, OutputPresentationType.MHTML);
						break;																  
					case "html": case "htm":
						report.RunRender(sg, OutputPresentationType.HTML);
						break;
                    case "csv":
                        report.RunRender(sg, OutputPresentationType.CSV);
                        break;
                    case "xlsx":
                        report.RunRender(sg, OutputPresentationType.Excel);
                        break;
                    case "rtf":
                        report.RunRender(sg, OutputPresentationType.RTF);
                        break;
                    case "tif": case "tiff":
                        report.RunRender(sg, OutputPresentationType.TIF);
                        break;
                    case "tifb":
                        report.RunRender(sg, OutputPresentationType.TIFBW);
                        break;
					default:
						Console.WriteLine("Unsupported file extension '{0}'.  Must be 'pdf', 'xml', 'mht', 'csv', 'xslx', 'rtf', 'tif', 'tifb' or 'html'", type);
						returnCode = 8;
						break;
				}
			}
			catch(Exception e)
			{
				Console.WriteLine(e.Message);
				returnCode = 8;
			}
			finally
			{
				if (sg != null)
				{
					sg.CloseMainStream();
				}
			}

			if (report.ErrorMaxSeverity > 0) 
			{
				// have errors fill out the msgs 
				Console.WriteLine("{0} has the following runtime errors:", FileName);
				foreach (string emsg in report.ErrorItems)
				{
					Console.WriteLine(emsg);		// output message to console
				}
				report.ErrorReset();
			}

			return;
		}