Ejemplo n.º 1
0
    void StiReportViewer_ReportExport(object sender, StiExportDataEventArgs e)
    {
        try
        {
            if (e.Settings.GetExportFormat() == StiExportFormat.Excel || e.Settings.GetExportFormat() == StiExportFormat.Excel2007)
            {
                this.StiReportViewer.ExportResponse = false;
                Stimulsoft.Report.Export.StiExcelExportSettings stiExcelExportSettings = new Stimulsoft.Report.Export.StiExcelExportSettings();
                stiExcelExportSettings.ExportDataOnly            = true;
                stiExcelExportSettings.UseOnePageHeaderAndFooter = true;
                stiExcelExportSettings.ExportPageBreaks          = false;
                stiExcelExportSettings.ExportObjectFormatting    = false;
                MemoryStream xlsMemoryStream = new MemoryStream();
                e.Report.ExportDocument(StiExportFormat.Excel, xlsMemoryStream, stiExcelExportSettings);

                Response.Clear();
                Response.AddHeader("content-disposition", "attachment;  filename=Report.xls");
                Response.ContentType = "application/ms-excel";
                Response.BinaryWrite(xlsMemoryStream.ToArray());
                Response.End();
            }
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 2
0
 private void StiWebViewer1OnReportExport(object sender, StiExportDataEventArgs stiExportDataEventArgs)
 {
     DBDataContext.AddViewReports(
         Tools.Security.User.GetSID(),
         HttpContext.Current.User.Identity.Name,
         HttpContext.Current.User.Identity.Name,
         ReportInitializerSection.GetReportInitializerSection().ReportPageViewer + "?ClassName=" + Request.QueryString["reportName"],
         HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority),
         Environment.MachineName,
         true,
         BuildManager.GetType(Request.QueryString["reportName"], true, true));
 }