excel 报告设置弹出窗口在获取 excel 报告时不显示
The excel report Settings pop-up doesn't show on getting an excel report
我使用 Stimulsoft 2017。单击 excel 报告的选项后,什么也没有出现,它应该显示导出设置,如图所示 below.And 它只是下载 excel突然报告。
我使用此代码生成 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)
{
}
终于弄明白是用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>
应如下所示更改此方式:
<Sti:StiWebViewer ID="StiReportViewer" runat="server" Width="100%" RenderMode="AjaxWithCache"
ButtonsImagesPath="Images" ToolBarBackColor="WhiteSmoke" OnGetReportData="StiReportViewer_GetReportData" ButtonImagesPath="Images/ReportViewer/" ShowExportDialog="true">
</Sti:StiWebViewer>
我使用 Stimulsoft 2017。单击 excel 报告的选项后,什么也没有出现,它应该显示导出设置,如图所示 below.And 它只是下载 excel突然报告。
我使用此代码生成 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)
{
}
终于弄明白是用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>
应如下所示更改此方式:
<Sti:StiWebViewer ID="StiReportViewer" runat="server" Width="100%" RenderMode="AjaxWithCache"
ButtonsImagesPath="Images" ToolBarBackColor="WhiteSmoke" OnGetReportData="StiReportViewer_GetReportData" ButtonImagesPath="Images/ReportViewer/" ShowExportDialog="true">
</Sti:StiWebViewer>