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


C# ReportDocument.ExportToStream方法代码示例

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


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

示例1: btnImprimir_Click

    protected void btnImprimir_Click(object sender, EventArgs e)
    {
        string Ciclo = this.ddlCiclo.SelectedValue;
        int Zona = int.Parse(this.ddlZonas.SelectedValue);
        int PlantelID = int.Parse(this.ddlPlanteles.SelectedValue);
        byte Turno = byte.Parse(this.ddlTurnos.SelectedValue);
        int Estatus = int.Parse(ddlEstatus.SelectedValue);

        string NomPlantel = this.ddlPlanteles.SelectedItem.Text;

        db = new DBEscolarDataContext();
        var res = (from A in db.vwRPTEstadisticaPreInscritos011s
                   where A.Ciclo == Ciclo && A.Zona == Zona && A.PlantelID == PlantelID && A.Turno == (Turno == 0 ? A.Turno : Turno)
                    && A.Estatus == (Estatus == -1 ? A.Estatus : Estatus)
                   orderby A.Zona, A.Plantel, A.Turno, A.Nombre
                   select A).ToList();

        this.lblMensaje.Visible = res.Count() == 0;
        if (res.Count() == 0)
            return;

        ReportDocument rptDoc = new ReportDocument();

        rptDoc.Load(Server.MapPath("../Reportes/rptEstPre01.rpt"));
        rptDoc.SetDataSource(res);
        rptDoc.SetParameterValue("NomPlantel", NomPlantel);

        MemoryStream stream = (MemoryStream)rptDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
        rptDoc.Close();
        rptDoc.Dispose();

        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/vnd.ms-excel";
        Response.AddHeader("Content-Disposition", "inline; filename=Alumnos.xls");
        Response.BinaryWrite(stream.ToArray());
        Response.End();
        stream.Close();
        stream.Dispose();
    }
开发者ID:amoras5,项目名称:cb_reinscripcion,代码行数:40,代码来源:Preinscripciones.aspx.cs

示例2: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable _dtCabeceraOper = null;
                DataTable _dtDetalleOper = null;
                _dtCabeceraOper = (DataTable)Session["dtCabeceraOperacion"];
                _dtDetalleOper = CopiarDT(g_dtDetOperacion);
                _dtDetalleOper = CambiarMonedaDetOperacion(_dtDetalleOper);

                if (_dtDetalleOper != null && _dtCabeceraOper != null)
                {
                    if (_dtDetalleOper.Rows.Count != 0)
                    {
                        ReportDocument rpt = new ReportDocument();
                        rpt.Load(Server.MapPath("rpt/crFactura.rpt"));
                        rpt.FileName = Server.MapPath("rpt/crFactura.rpt");
                        rpt.SetDataSource(_dtCabeceraOper);
                        rpt.Subreports[0].SetDataSource(_dtDetalleOper);

                        CrystalReportViewer1.ReportSource = rpt;
                        CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;

                        // bloque de código donde exportamos el reporte a pdf directamente
                        using (var mStream = (MemoryStream)rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat))
                        {
                            Response.Clear();
                            Response.Buffer = true;
                            Response.ContentType = "application/pdf";
                            Response.BinaryWrite(mStream.ToArray());
                        }
                        Response.End();
                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:sestremadoyro,项目名称:Agrocomercio,代码行数:41,代码来源:ImpresionFactura.aspx.cs

示例3: ExportReport

        public ActionResult ExportReport()
        {
            List<Investment> allInvestment = new List<Investment>();

            using (efarmingEntities dc = new efarmingEntities())
            {
                allInvestment = dc.Investments.ToList();
            }

            ReportDocument rd = new ReportDocument();
            rd.Load(Path.Combine(Server.MapPath("~/Reports"), "rpt_InvestmentList.rpt"));
            rd.SetDataSource(allInvestment);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();

            try
            {
                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return File(stream, "application/pdf", "InvestmentList.pdf");
            }
            catch (Exception)
            {

                throw;
            }
        }
开发者ID:arvind-web-developer,项目名称:csharp-projects-CrystalReports,代码行数:29,代码来源:HomeController.cs

示例4: 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

示例5: bindReport

 private void bindReport()
 {
     if (Convert.ToString(Session[Global.SESSION_KEY_CULTURE]) == "ar-AE")
     {
         dt = RL.PrintMaterListEnglish();
     }
     else
     {
         dt = RL.PrintMaterListEnglish();
     }
     if (dt.Rows.Count > 0)
     {
         ReportDocument report = new ReportDocument();
         report.Load(Server.MapPath("..//..//Reports//PrintAllMatter.rpt"));
         report.SetDataSource(dt);
         // report.Refresh();
         //CrystalReportViewer1.ReportSource = report;
         MemoryStream oStream = new MemoryStream(); // using System.IO
         oStream = (MemoryStream)report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
         Response.Clear(); Response.Buffer = true;
         Response.ContentType = "application/pdf";
         Response.BinaryWrite(oStream.ToArray());
         Response.End();
     }
 }
开发者ID:progressiveinfotech,项目名称:PRO-FY13-18_Habib-al-Mulla,代码行数:25,代码来源:PrintMatter.aspx.cs

示例6: DivSchedule

 private void DivSchedule()
 {
     string strExportFile = null;
     strExportFile = Session["Report"].ToString();
     ReportDocument crReportDocument = default(ReportDocument);
     crReportDocument = new ReportDocument();
     crReportDocument.Load(Server.MapPath(Session["Report"].ToString()));
     CSBC.Components.Season.ClsSchedules oData = new CSBC.Components.Season.ClsSchedules();
     //Pass the populated dataset to the report
     crReportDocument.SetDataSource(oData.GetGames(1, 1, Convert.ToInt32(Session["ScheduleNo"]),
         Convert.ToInt32(Session["TeamNbr"]), Session["ScheduleDesc"].ToString(), Session["TeamName"].ToString()));
     crReportDocument.SetParameterValue("SeasonDesc", Session["SeasonDesc"]);
     crReportDocument.SetParameterValue("CompanyName", Session["CompanyName"]);
     crReportDocument.SetParameterValue("TeamName", Session["TeamName"]);
     crReportDocument.SetParameterValue("Division", Session["ScheduleDesc"]);
     System.IO.MemoryStream s =
         (MemoryStream) crReportDocument.ExportToStream(ExportFormatType.PortableDocFormat);
     var _with1 = HttpContext.Current.Response;
     _with1.ClearContent();
     _with1.ClearHeaders();
     _with1.ContentType = "application/pdf";
     _with1.AddHeader("Content-Disposition", "inline; filename=" + strExportFile);
     _with1.BinaryWrite(s.ToArray());
     _with1.End();
     //CrystalReportViewer1.ReportSource = crReportDocument
     crReportDocument = null;
     oData = null;
 }
开发者ID:rsalit,项目名称:CSBC,代码行数:28,代码来源:Report.aspx.cs

示例7: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        String qs = Request.QueryString.Get("bid");
        Response.Write("Query String = " + qs);
        SqlConnection sql = new SqlConnection();
        sql.ConnectionString = "Data Source=(local);Initial Catalog=Hotel;Integrated Security=True";
        sql.Open();

        ReportDocument rpd = new ReportDocument();
        rpd.Load(Server.MapPath("itcreport.rpt"));
        rpd.SetDatabaseLogon("sa", "ak");
        rpd.SetParameterValue(0, qs);
        CrystalReportViewer1.ReportSource = rpd;

        //to convert report in pdf format
        MemoryStream ostream = new MemoryStream();
        Response.Clear();
        Response.Buffer = true;
        ostream = (MemoryStream)rpd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        rpd.Close();
        rpd.Dispose();
        Response.ContentType = "application/pdf";
        Response.BinaryWrite(ostream.ToArray());
        ostream.Flush();
        ostream.Close();
        ostream.Dispose();
    }
开发者ID:akshaykhanna,项目名称:Hotel-Booking-website,代码行数:27,代码来源:report.aspx.cs

示例8: CriaPDF

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

            DSCabecalhoSolicitacaoAmbulatorial cabecalho = new DSCabecalhoSolicitacaoAmbulatorial();
            cabecalho.Tables.Add((DataTable)hash["cabecalho"]);

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

            Session.Remove("HashSolicitacoes");
            ReportDocument repDoc = new ReportDocument();
            repDoc.Load(Server.MapPath("RelatoriosCrystal/CrystalReportViewer_SolicitacaoAmbulatorial.rpt"));
            repDoc.SetDataSource(conteudo.Tables[1]);
            repDoc.Subreports["CrystalReportViewer_CabecalhoSolicitacaoAmbulatorial.rpt"].SetDataSource(cabecalho.Tables[1]);

            System.IO.Stream s = repDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "application/octet-stream";
            Response.AddHeader("content-disposition", "attachment; filename=RelatorioSolicitacaoAmbulatorial.pdf");
            Response.AddHeader("content-length", ((System.IO.MemoryStream)s).ToArray().Length.ToString());
            Response.BinaryWrite(((System.IO.MemoryStream)s).ToArray());
            Response.End();
            //Response.Flush();
            //Response.Close();
        }
开发者ID:vivermais,项目名称:vivermais,代码行数:27,代码来源:RelatorioSolicitacaoAmbulatorial.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: 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

示例11: GetStreamReporte

        public virtual System.IO.Stream GetStreamReporte(ExportFormatType Formato)
        {
            ReportDocument reportDocument = new ReportDocument();
            string path = Path.Combine(Path.Combine(Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory), "Reportes\\"), ClaseReporte.ResourceName);
            reportDocument.Load(path);
            reportDocument.SetDataSource(GetDatosReporte());

            return reportDocument.ExportToStream(Formato);
        }
开发者ID:enzoburga,项目名称:pimesoft,代码行数:9,代码来源:ReporteAbs.cs

示例12: ErzeugeEtb

 /// <summary>
 /// Diese Funktion lädt alle Systemereignisse.
 /// <returns name="pout_Systemereignisse">Menge aller Systemereignisse die bisher geworfen wurde.</returns>
 /// </summary>
 public System.IO.Stream ErzeugeEtb()
 {
     // Erstellen eines Reports
     ReportDocument pout_Report = new ReportDocument();
     // Lade Reportvorlage
     pout_Report.Load(System.IO.Directory.GetCurrentDirectory() + @"\ReportVorlagen\ETB.rpt");
     Console.WriteLine(System.IO.Directory.GetCurrentDirectory());
     // muss als Stream übertragen werden, da ReportDocuments nicht Serializable sind
     return pout_Report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
 }
开发者ID:BackupTheBerlios,项目名称:pels-svn,代码行数:14,代码来源:PortalLogik_ETB.cs

示例13: Imprimir

    private void Imprimir(int AlumnoID)
    {
        DBEscolarDataContext db = new DBEscolarDataContext();
        var Pago = (from P in db.vwRPTPagosEncabezados join D in db.vwRPTPagosDetalles on P.PagoID equals D.PagoID
                    where P.AlumnoID == AlumnoID && P.Ciclo == Utils.CicloActual && (P.Estatus != 0)
                    && D.Clave == "A01"
                    select P).FirstOrDefault();

        if (Pago == null)
        {
            this.lblMensaje.Text = "No se ha encontrado la ficha de pago.<br />Nota: Para poder generar la Ficha de Pago, debes de estar validado.";
            return;
        }
        else if (Pago.Estatus == 3) {

            Alumno Alumno = (from A in db.Alumnos
                             where A.AlumnoID == AlumnoID
                             select A).FirstOrDefault();

            this.lblMensaje.Text = "Felicidades. Tú ficha ha sido pagada y ya te encuentras inscrito con matrícula: " + Alumno.Matricula;
            return;

        }

        var Detalle = (from D in db.vwRPTPagosDetalles
                       where D.PagoID == Pago.PagoID
                       select D).ToList();

        //Actualiza el estatus del pago a 2:Impreso
        db.spEXEPagosCambiaEstatus(AlumnoID, Pago.PagoID, 2, Utils.CicloActual);

        ArrayList col = new ArrayList();
        col.Add(Pago);
        ReportDocument rptDoc = new ReportDocument();

        rptDoc.Load(Server.MapPath("Reportes/rptFichaDePago.rpt"));
        //set dataset to the report viewer.
        rptDoc.SetDataSource(col);
        rptDoc.Subreports["Detalle"].SetDataSource(Detalle);
        rptDoc.Subreports["Detalle2"].SetDataSource(Detalle);

        MemoryStream stream = (MemoryStream)rptDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        rptDoc.Close();
        rptDoc.Dispose();
        Response.Clear();
        Response.ContentType = @"Application/pdf";
        Response.AddHeader("Content-Disposition", "inline; filename=FichaDePago.pdf");
        Response.AddHeader("content-length", stream.Length.ToString());
        Response.BinaryWrite(stream.ToArray());
        Response.Flush();
        stream.Close();
        stream.Dispose();
    }
开发者ID:amoras5,项目名称:cb_reinscripcion,代码行数:53,代码来源:ImprimirFichaDePago.aspx.cs

示例14: GenerateReport

        //Relatório de LISTA DE DESPESAS .PDF (Crystal Report) - Funcionando mas vem sem parâmetors ainda 24/11/2015.
        public ActionResult GenerateReport()
        {
            ReportDocument rd = new ReportDocument(); //(Crystal Report)
           
            rd.Load(Path.Combine(Server.MapPath("../Reports/CrystalReportDespesas.rpt")));
            ViewBag.ListDespesas = db.DespesasEmps.ToList();

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();
            Stream stream = rd.ExportToStream
               (CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            stream.Seek(0, SeekOrigin.Begin);
            return File(stream, "application/pdf", "ListaDespesas.pdf");

        }
开发者ID:williampicanco,项目名称:Projeto-ASP.NET-MVC5_controle-Receitas-Despesas,代码行数:17,代码来源:DespesasEmpsController.cs

示例15: CrystalReportResult

        public CrystalReportResult(string reportPath, object dataSet,List<ReportParameter> paramList,string type="pdf")
        {
            ReportDocument reportDocument = new ReportDocument();
            reportDocument.Load(reportPath);

            reportDocument.SetDataSource(dataSet);
            foreach (var item in paramList)
            {
                reportDocument.SetParameterValue(item.Name, item.Value);
            }

            #region extra
            //ParameterValues currentParameterValues = new ParameterValues();
            //ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
            //ParameterFieldDefinitions parameterFieldDefinitions = reportDocument.DataDefinition.ParameterFields;
            //ParameterFieldDefinition parameterFieldDefinition;

            //foreach (var param in paramList)
            //{
            //    if (param.Value != null)
            //    {
            //        if (param.IsInteger)
            //            var value = Int64.Parse(param.Value);
            //        else if (param.IsDateTime)
            //            parameterDiscreteValue.Value = DateTime.Parse(param.Value);
            //        else if (param.IsBoolean)
            //            parameterDiscreteValue.Value = bool.Parse(param.Value);
            //        else
            //            parameterDiscreteValue.Value = param.Value;
            //    }
            //    else
            //    {
            //        parameterDiscreteValue.Value = DBNull.Value;
            //    }

            //    currentParameterValues.Add(parameterDiscreteValue);

            //    parameterFieldDefinition = parameterFieldDefinitions[param.Name];
            //    parameterFieldDefinition.ApplyCurrentValues(currentParameterValues);

            //}
            #endregion

            _contentBytes = StreamToBytes(reportDocument.ExportToStream(GetFormatType(type)));
        }
开发者ID:Mithunchowdhury,项目名称:Erpoptima,代码行数:45,代码来源:CrystalReportResult.cs


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