当前位置: 首页>>代码示例>>C#>>正文


C# ReportDocument类代码示例

本文整理汇总了C#中ReportDocument的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument类的具体用法?C# ReportDocument怎么用?C# ReportDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ReportDocument类属于命名空间,在下文中一共展示了ReportDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowGenericRpt

        public void ShowGenericRpt()
        {
            try
            {
                bool isValid = true;

                string strReportName = System.Web.HttpContext.Current.Session["ReportName"].ToString();    // Setting ReportName

                if (string.IsNullOrEmpty(strReportName))
                {
                    isValid = false;
                }

                if (isValid)
                {
                    ReportDocument rd = new ReportDocument();
                    string strRptPath = System.Web.HttpContext.Current.Server.MapPath("~/") + "Report//" + strReportName;
                    rd.Load(strRptPath);
                    rd.VerifyDatabase();
                    rd.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport");
                    // Clear all sessions value
                    Session["ReportName"] = null;
                }
                else
                {
                    Response.Write("<H2>Nothing Found; No Report name found</H2>");
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
开发者ID:NguyenHoangDuy,项目名称:MVC_ESM,代码行数:33,代码来源:GenericReportViewerController.cs

示例2: frmReporteTurnosMedico

        public frmReporteTurnosMedico(ReportDocument rd)
        {
            InitializeComponent();

            crvForm.ReportSource = rd;

        }
开发者ID:pelad0,项目名称:Fenix1.0,代码行数:7,代码来源:frmReporteTurnosMedico.cs

示例3: ErzeugeReport

 /// <summary>
 /// Erzeugt aus einer CrystalReportsDatei oder einem PDF einen PDF Stream und sendet ihn an den Client
 /// </summary>
 /// <param name="pin_ReportVorlage">Pfad der Vorlage</param>
 /// <param name="pin_ReportAuswahl">reportspezifische Daten</param>
 /// <returns>Stream der ein PDF enthält</returns>
 public Stream ErzeugeReport(string pin_ReportVorlage, string pin_ReportAuswahl)
 {
     if (pin_ReportVorlage.Substring(pin_ReportVorlage.LastIndexOf(".") + 1) == "pdf")
     {
         // Umwandeln des PDF Vordrucks in einen Stream
         FileStream Report = new FileStream(Directory.GetCurrentDirectory() + pin_ReportVorlage, System.IO.FileMode.Open, System.IO.FileAccess.Read);
         byte[] Buffer = new byte[(int)Report.Length];
         Report.Read(Buffer, 0, (int)Report.Length);
         Report.Close();
         // Versenden der Daten als MemoryStream
         System.Windows.Forms.MessageBox.Show("Schicke Raus !!");
         return new MemoryStream(Buffer, 0, Buffer.Length);
     }
     else
     {
         // Erstellen eines Reports
         ReportDocument Report = new ReportDocument();
         // Lade Reportvorlage
         Report.Load(Directory.GetCurrentDirectory() + pin_ReportVorlage);
         // Besondere SELECT Anfrage auf den Datensatz anwenden
         if (pin_ReportAuswahl != String.Empty)
             Report.DataDefinition.RecordSelectionFormula = pin_ReportAuswahl;
         // muss als Stream übertragen werden, da ReportDocuments nicht Serializable sind
         return Report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
     }
 }
开发者ID:BackupTheBerlios,项目名称:pels-svn,代码行数:32,代码来源:PortalLogik_Report.cs

示例4: ExportarPDF

        private void ExportarPDF(ReportDocument rep)
        {
            String ruta_exportacion;

            ruta_exportacion = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"]);
            //ruta_exportacion = System.Configuration.ConfigurationSettings.AppSettings["ruta_exportacion_pdf"];

            ExportOptions exportOpts = new ExportOptions();
            DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();

            exportOpts = rep.ExportOptions;
            exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;

            exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
            diskOpts.DiskFileName = ruta_exportacion + Session.SessionID.ToString() + ".pdf";
            exportOpts.DestinationOptions = diskOpts;

            rep.Export();

            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "application/pdf";
            Response.WriteFile(diskOpts.DiskFileName.ToString());
            Response.Flush();
            Response.Close();
            System.IO.File.Delete(diskOpts.DiskFileName.ToString());
        }
开发者ID:yesashii,项目名称:upa,代码行数:27,代码来源:MorosidadCobranza.aspx.cs

示例5: GenerateReport

    protected void GenerateReport()
    {
        System.Console.Beep();

                //Create report document
                ReportDocument crystalReport = new ReportDocument();

                if (txtStart.Text != "" && txtEnd.Text != "" )
                {

                        //Load crystal report made in design view
                        crystalReport.Load(Server.MapPath("Reports/Notifications.rpt"));

                        //Set DataBase Login Info
                        crystalReport.SetDatabaseLogon("root", "123", @"localhost", "nsis");

                        //Provide parameter values
                        crystalReport.SetParameterValue("start", txtStart.Text.ToString());
                        crystalReport.SetParameterValue("end", txtEnd.Text.ToString());

                        //Set Report in to Report Viewer
                        crvReportViewer.ReportSource = crystalReport;

            }
            else
            {
               // lblError.ForeColor = Color.Red;
               // lblError.Text = "Please Provide Valid Details";
            }
    }
开发者ID:neonmax,项目名称:sims,代码行数:30,代码来源:Sent_Notification_Report.aspx.cs

示例6: btnSearch_Click

        private void btnSearch_Click(object sender, EventArgs e)
        {
            int DoctorID;
            DoctorID = Convert.ToInt32(cbDoctor.SelectedValue.ToString());
            ReportDocument reportDocument = new ReportDocument();
            ParameterField paramField = new ParameterField();
            ParameterFields paramFields = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
            string ReportPath = ConfigurationManager.AppSettings["ReportPath"];

            paramField.Name = "@DoctorID";

            paramDiscreteValue.Value = DoctorID;
            reportDocument.Load(ReportPath + "Report\\DoctorCrystalReport.rpt");

            ConnectionInfo connectionInfo = new ConnectionInfo();
            connectionInfo.DatabaseName = "DB_MedicalShop_02Sept20159PM";
            //connectionInfo.UserID = "wms";
            //connectionInfo.Password = "wms";
            connectionInfo.IntegratedSecurity = true;
            SetDBLogonForReport(connectionInfo, reportDocument);

            reportDocument.SetParameterValue("@DoctorID", DoctorID);
            DoctorCrystalRpt.ReportSource = reportDocument;

            DoctorCrystalRpt.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
        }
开发者ID:Anshul0305,项目名称:lotas,代码行数:27,代码来源:Form_Doctor_Detail_Report.cs

示例7: cboYear_SelectedIndexChanged

 private void cboYear_SelectedIndexChanged(object sender, EventArgs e)
 {
      try
      {
          string RepPath;
          DataSet dataset = new DataSet();
          ReportDocument RepDoc = new ReportDocument();                 
          RepPath = @"D:\Project\Industrial College\Project1\Source23\Source22\Source21\Pazhohesh\Pazhohesh\Main\CrsThesis1.rpt";                 
          RepDoc.Load(RepPath);                    
          objDataAdapter.SelectCommand = new SqlCommand();
          SqlConnection objConnection = new SqlConnection("Data Source=User-PC;Initial Catalog=ResearchProje1;Integrated Security=True");
          objDataAdapter.SelectCommand.Connection = objConnection;
          DataTable objGozaresh = new DataTable();
          objGozaresh.Clear();
          objDataAdapter.SelectCommand.Parameters.AddWithValue("@DeliveryDate" , cboYear.Text + "%");
          objDataAdapter.SelectCommand.CommandText = "Select * from VwThesisGozaresh1 where DeliveryDate Like @DeliveryDate";
          objDataAdapter.Fill(objGozaresh);
          RepDoc.SetDataSource(objGozaresh);
          crystalReportViewer1.ReportSource = RepDoc;
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.ToString());
      }
 }
开发者ID:rad-navid,项目名称:forms-automation,代码行数:25,代码来源:FrmReportThesis.cs

示例8: setParameters

        public void setParameters(ReportDocument Rpt)
        {
            if (HttpContext.Current.Request.QueryString["StartDate"] != null && HttpContext.Current.Request.QueryString["EndDate"] != null)
            {
                ParameterFields paramFields = new ParameterFields();
                ParameterField StartDay, EndDay;
                ParameterDiscreteValue dcStartDay, dcEndDay;
                StartDay = new ParameterField();
                StartDay.ParameterFieldName = "@FromDate";
                dcStartDay = new ParameterDiscreteValue();
                dcStartDay.Value = Request.QueryString["StartDate"].ToString();

                EndDay = new ParameterField();
                EndDay.ParameterFieldName = "@ToDate";
                dcEndDay = new ParameterDiscreteValue();
                dcEndDay.Value = Request.QueryString["EndDate"].ToString();

                StartDay.CurrentValues.Add(dcStartDay);
                EndDay.CurrentValues.Add(dcEndDay);
                paramFields.Add(StartDay);
                paramFields.Add(EndDay);

                AdminActivityCRViewer.ParameterFieldInfo = paramFields;
                AdminActivityCRViewer.ReportSource = Rpt;
                AdminActivityCRViewer.DataBind();
            }
        }
开发者ID:shekar348,项目名称:1PointOne,代码行数:27,代码来源:AdminActivityRpts.aspx.cs

示例9: CriaPDF

        protected void CriaPDF()
        {
            Hashtable hash = (Hashtable)Session["HashVagasDisponivel"];

            //CrystalReportViewer_AgendaPrestador.DisplayToolbar = true;
            //CrystalReportViewer_AgendaPrestador.EnableDatabaseLogonPrompt = false;

            DSRelatorioVagasDisponivel conteudo = new DSRelatorioVagasDisponivel();
            conteudo.Tables.Add((DataTable)hash["corpo"]);

            ReportDocument repDoc = new ReportDocument();
            repDoc.Load(Server.MapPath("RelatoriosCrystal/CrystalReportViewer_VagasDisponivel.rpt"));
            repDoc.SetDataSource(conteudo.Tables[1]);

            //repDoc.Database.Tables["CabecalhoAgendaPrestador"].SetDataSource((DataTable)hash["cabecalho"]);
            //repDoc.Database.Tables["RelatorioAgendaPrestador"].SetDataSource((DataTable)hash["corpo"]);

            System.IO.Stream s = repDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "applicattion/octect-stream";
            Response.AddHeader("Content-Disposition", "attachment;filename=RelatorioVagasDisponivel.pdf");
            Response.AddHeader("Content-Length", s.Length.ToString());
            Response.BinaryWrite(((System.IO.MemoryStream)s).ToArray());
            Response.End();
        }
开发者ID:vivermais,项目名称:vivermais,代码行数:26,代码来源:RelatorioVagas.aspx.cs

示例10: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                ReportDocument rd;
                rd = new ReportDocument();
            rd.Load(@"C:\Users\PLABON\Documents\Visual Studio 2013\Projects\SalesAndInventorySystem\SalesAndInventorySystemUI\Report\a.rpt");
            List<PersonType> company = companyGateway.GetCompanies();
            var companyX = company.Select(x => new {x.ID, x.Name});
            rd.SetDataSource(companyX);
            crystalReportViewer1.ReportSource = rd;

            crystalReportViewer1.Refresh();
                int a = 10;
            if (File.Exists(@"D:\" + "AAAA" + a  +".pdf"))
                File.Delete(@"D:\" + a++ + ".pdf");
            rd.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, @"D:\" + a + ".pdf");

            }
            catch (Exception)
            {

                throw;
            }
        }
开发者ID:manjurul-cse,项目名称:Sales-And-Inventory-System,代码行数:25,代码来源:Form1.cs

示例11: CriaPDF

        private void CriaPDF()
        {
            Hashtable hashtable = (Hashtable)Session["HashAgendaMontadaPublicada"];

            DSCabecalhoAgendaMontadaPublicada cabecalho = new DSCabecalhoAgendaMontadaPublicada();
            cabecalho.Tables.Add((DataTable)hashtable["cabecalho"]);

            DSRelatorioAgendaMontadaPublicada dados = new DSRelatorioAgendaMontadaPublicada();
            dados.Tables.Add((DataTable)hashtable["dados"]);

            ReportDocument repDoc = new ReportDocument();

            repDoc.Load(Server.MapPath("RelatoriosCrystal/CrystalReportViewer_AgendaMontadaPublicada.rpt"));
            repDoc.SetDataSource(dados.Tables[1]);
            repDoc.Subreports["CrystalReportViewer_CabecalhoAgendaMontadaPublicada.rpt"].SetDataSource(cabecalho.Tables[1]);

            System.IO.Stream s = repDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "applicattion/octect-stream";
            Response.AddHeader("Content-Disposition", "attachment;filename=RelatorioDeAgendasMontadasPublicadas.pdf");
            Response.AddHeader("Content-Length", s.Length.ToString());
            Response.BinaryWrite(((System.IO.MemoryStream)s).ToArray());
            Response.End();

            Session.Remove("HashAgendaMontadaPublicada");
        }
开发者ID:vivermais,项目名称:vivermais,代码行数:27,代码来源:RelatorioAgendaMontadaPublicada.aspx.cs

示例12: GenerateWord

		private void GenerateWord()
		{
            ReportDocument rpt = new ReportDocument();
            rpt.Load(Server.MapPath(Constants.ROOT_DIRECTORY + "/Reports/GeneralLedger.rpt"));

			ExportOptions exportop = new ExportOptions();
			DiskFileDestinationOptions dest = new DiskFileDestinationOptions();
			
			string strPath = Server.MapPath(@"\retailplus\temp\");

			string strFileName = "generalledger_" + Session["UserName"].ToString() + "_" + DateTime.Now.ToString("yyyyMMddhhmmssff") + ".doc";
			if (System.IO.File.Exists(strPath + strFileName))
				System.IO.File.Delete(strPath + strFileName);

			dest.DiskFileName = strPath + strFileName;

			exportop = rpt.ExportOptions;
	
			SetDataSource(rpt);

			exportop.DestinationOptions = dest;
			exportop.ExportDestinationType = ExportDestinationType.DiskFile;
			exportop.ExportFormatType = ExportFormatType.WordForWindows;
			rpt.Export();   rpt.Close();    rpt.Dispose();
			
			fraViewer.Attributes.Add("src","/retailplus/temp/" + strFileName);
		}
开发者ID:marioricci,项目名称:erp-luma,代码行数:27,代码来源:_GeneralLedger.ascx.cs

示例13: frminhoadon_Load

 private void frminhoadon_Load(object sender, EventArgs e)
 {
     DataTable ds = hdbus.getHoaDon(KHAIBAO.mabenhnhan, KHAIBAO.ngaykham);
     ds.TableName = "HoaDon";
     DataTable dt2 = ctkbus.getDonThuoc(KHAIBAO.mabenhnhan + KHAIBAO.ngaykham);
     dt2.TableName = "DonThuoc";
     DataTable dt3 = cdbus.getCachDung();
     dt3.TableName = "CachDung";
     DataTable dt4 = ltbus.getLoaiThuoc();
     dt4.TableName = "LoaiThuoc";
     DataTable dt5 = dvbus.getDonVi();
     dt5.TableName = "DonVi";
     DataSet dts = new DataSet();
     dts.Tables.Add(ds);
     dts.Tables.Add(dt2);
     dts.Tables.Add(dt3);
     dts.Tables.Add(dt4);
     dts.Tables.Add(dt5);
     if (float.Parse(ds.Rows[0]["TienThuoc"].ToString()) == 0)
     {
         ReportDocument report = new ReportDocument();
         report.Load("..\\..\\inhoadon1.rpt");
         report.SetDataSource(dts);
         crystalReportViewer.ReportSource = report;
         inhoadon1 dt = new inhoadon1();
     }
     else
     {
         ReportDocument report = new ReportDocument();
         report.Load("..\\..\\inhoadon.rpt");
         report.SetDataSource(dts);
         crystalReportViewer.ReportSource = report;
         inhoadon dt = new inhoadon();
     }
 }
开发者ID:tuanva90,项目名称:qlphongmach4,代码行数:35,代码来源:frminhoadon.cs

示例14: InitializeLanguage

 static void InitializeLanguage(ReportDocument reportDocument)
 {
     var language = GetCurrentLanguage();
     reportDocument.ReportClientDocument.PreferredViewingLocaleID = language;
     reportDocument.ReportClientDocument.LocaleID = language;
     reportDocument.ReportClientDocument.ProductLocaleID = language;
 }
开发者ID:Slesa,项目名称:Playground,代码行数:7,代码来源:MainWindow.xaml.cs

示例15: LoadReportFile

        private void LoadReportFile(string rptName, string procName, string rptTitle, Dictionary<string, string> paraValues, Dictionary<string, string> procValues)
        {
            try
            {
                string rptPath = Server.MapPath("/ReportPages/" + rptName);

                _rptDoc = new ReportDocument();
                _rptDoc.Load(rptPath);
                _rptDoc.SummaryInfo.ReportTitle = rptTitle;
                _rptDoc.SetDataSource(ExcuteQuery(procName, procValues));
                if (paraValues.Count > 0)
                    foreach (KeyValuePair<string, string> par in paraValues)
                    {
                        ParameterDiscreteValue pValue = new ParameterDiscreteValue();
                        pValue.Value = par.Value;
                        ParameterFieldDefinition pDef = _rptDoc.DataDefinition.ParameterFields[par.Key];
                        pDef.CurrentValues.Clear();
                        pDef.CurrentValues.Add(pValue);
                        pDef.ApplyCurrentValues(pDef.CurrentValues);

                    }
                crystalReportViewer.ReportSource = _rptDoc;
            }
            catch (Exception e)
            {
                label.Text = "Report Error: " + e.Message;
            }
            finally
            {
                GC.Collect();
            }
        }
开发者ID:CanhNguyenVan,项目名称:ooad-dev,代码行数:32,代码来源:ReportPage.aspx.cs


注:本文中的ReportDocument类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。