将ReportViewer导出到Excel和PDF的问题,获取Name = .xls [1]和.pdf [1] [英] Problem to Export ReportViewer to Excel and PDF, get Name = .xls[1] and .pdf[1]

查看:244
本文介绍了将ReportViewer导出到Excel和PDF的问题,获取Name = .xls [1]和.pdf [1]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有问题将结果从ReportViewer导出到Excel或PDF。

In my application I have problem to export the result from a ReportViewer to Excel or PDF.

文件下载窗口中的名称设置为".xls [1 ]"或".pdf [1]"。

The Name in the File Download Window is set to ".xls[1]" or ".pdf[1]".

使用以下代码生成报告:

The report is generated with the following code:

DataView dw;

DataView dw;

dw = getData();

dw = getData();

ReportDataSource datasource = new

ReportDataSource datasource = new

ReportDataSource "" DataSetReport_Savings" ,dw);

 

ReportViewer1.Reset();

ReportViewer1.Reset();

ReportParameter effectYear = new ReportParameter " EffectYear" String .IsNullOrEmpty(DropDownListEffectYear.SelectedItem.Text)== true " All" :DropDownListEffectYear.SelectedItem.Text);

ReportParameter effectYear = new ReportParameter("EffectYear", String.IsNullOrEmpty(DropDownListEffectYear.SelectedItem.Text) == true ? "All" : DropDownListEffectYear.SelectedItem.Text);

ReportViewer1.LocalReport.SetParameters( new ReportParameter [] {effectYear });

ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { effectYear });

ReportViewer1.LocalReport.ReportEmbeddedResource = @" Reports\Savings\ReportPerAccount.rdlc" ;

ReportViewer1.LocalReport.ReportEmbeddedResource = @"Reports\Savings\ReportPerAccount.rdlc";

ReportViewer1 .LocalReport.ReportPath = @" Reports\Savings\ReportPerAccount.rdlc" ;

ReportViewer1.LocalReport.ReportPath = @"Reports\Savings\ReportPerAccount.rdlc";

ReportViewer1.LocalReport.DisplayName = " Account" ;

ReportViewer1.LocalReport.DisplayName = "Account";

ReportViewer1.ProcessingMode = ProcessingMode .Local;

ReportViewer1.ProcessingMode = ProcessingMode.Local;

ReportViewer1.LocalReport.DataSources.Clear();

ReportViewer1.LocalReport.DataSources.Clear();

ReportViewer1.LocalReport.DataSources.Add(datasource);

ReportViewer1.LocalReport.DataSources.Add(datasource);

ReportViewer1.LocalReport.Refresh();

ReportViewer1.LocalReport.Refresh();

任何人都可以告诉我我错过了什么让名称正确吗? ,它应该是Account.xls resp。 Account.pdf

Can anyone tell me what I have missed to get the Name right? , it should have been Account.xls resp. Account.pdf 

亲切的问候

Thomas Peterson

Thomas Peterson

推荐答案

这个问题有解决方法吗?

我有同样的情况:

以本地模式报告查看器。我还设置了报告显示名称属性。仍然当我试图导出它时,它将其输出为类型".pdf [1]"和".xls [1]。

Report viewer in local mode.  I'm also setting the report display name property.  Still when i'm trying to export it it exports it as type ".pdf[1]" and ".xls[1]. 

如果有人可以提供帮助,请

If anyone can help please


这篇关于将ReportViewer导出到Excel和PDF的问题,获取Name = .xls [1]和.pdf [1]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆