简体   繁体   English

获取 excel 报告时不显示 excel 报告设置弹出窗口

[英]The excel report Settings pop-up doesn't show on getting an excel report

I use Stimulsoft 2017. Once I click on the excel report's option nothing appears, which was supposed to show export settings as it is shown below.And it just download the excel report all of a sudden.我使用 Stimulsoft 2017。一旦我点击 excel 报告的选项,什么也没有出现,它应该显示如下所示的导出设置。它只是突然下载了 excel 报告。

在此处输入图片说明

I use this code to generate excel,but these settings don't make any effect on exported excel files.我使用此代码生成 excel,但这些设置对导出的 excel 文件没有任何影响。

    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)
    {
    }

Finally,I figure out that it runs with js, and there is a line of code that should change this way.最后,我发现它是用 js 运行的,并且有一行代码应该以这种方式改变。

   <Sti:StiWebViewer ID="StiReportViewer" runat="server" Width="100%" RenderMode="AjaxWithCache" 
                    ButtonsImagesPath="Images" ToolBarBackColor="WhiteSmoke" OnGetReportData="StiReportViewer_GetReportData" ButtonImagesPath="Images/ReportViewer/" ShowExportDialog="false">                    
                </Sti:StiWebViewer>

should change this way as show below:应该改变这种方式,如下所示:

 <Sti:StiWebViewer ID="StiReportViewer" runat="server" Width="100%" RenderMode="AjaxWithCache" 
                    ButtonsImagesPath="Images" ToolBarBackColor="WhiteSmoke" OnGetReportData="StiReportViewer_GetReportData" ButtonImagesPath="Images/ReportViewer/" ShowExportDialog="true">                    
                </Sti:StiWebViewer>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM