惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - Andy Yang

SharePoint中Event Handler的触发 - Andy Yang 扩展SharePoint链接字段 树莓派的连接 树莓派版的家用NAS服务器 修改树莓派更新源及设置代理配置 开启树莓派的硬件看门狗功能 树莓派上安装2.8寸TFT触摸屏 树莓派上使用蚂蚁矿机挖矿 如何编译树莓派内核 Bit-Coin收入的一分钱 如何在树莓派上运行雷神之锤III 新树莓派入手 如何通过PowerShell在Visual Studio的Post-build中预热SharePoint站点 将SharePoint 2010的快速启动改成弹出菜单样式 在SharePoint 2010的Team Site首页上显示Flash文件 SharePoint 2010搜索起步(下) - Andy Yang SharePoint 2010搜索起步(上) 2009上班第一天 软件开发与心理张力
代码导出Reporting Services报表文件
Andy Yang · 2014-03-20 · via 博客园 - Andy Yang

背景部分

使用Reporting Services很容易制作和发布我们需要的报表,报表效果也还不错

不过如果报表数据过大或报表数量过多,打开及查看报表感觉可能就是另外一回事了

好在Reporting Services提供了离线下载功能;同时,也提供了Web Services供开发人员调用

作为一个软件工程师,完全可以建一个控制台程序,代码写好,使用配置文件获取报表参数

运行,喝杯茶,所有的报表就下载到本地了~~~

技术部分

Web Services比较常用的服务地址如下

http://[RS Server Name]/ReportServer/ReportExecution2005.asmx

其中:[RS Server Name]是Reporting Services服务器的名字

我们当然可以在项目中添加Web Reference的方式加入Web Services

不过也可以使用VS工具中的WSDL生成编译文件,供后期项目重复使用,下载可以点击这里

对于导出报表功能,我也简单的获取了一个类来封装调用,下载可以点击这里

调用举例

Report rpt = new Report();

// 以下参数按照实际环境修改

rpt.ServerUrl = "http://[RS Server Name]/ReportServer";

rpt.UserName = "User Name";

rpt.Password = "Password";

rpt.Domain = "Domain Name";

// 报表所在的路径,参考下图

rpt.FolderPath = "/Northwind Reports/NorthwindCustomers";

// 导出文件的格式

rpt.Format = ReportFormat.EXCEL;

// 导出到指定位置

rpt.Export(@"C:\Nw2.pdf");

如果需要传入参数,可以参考如下

rpt.Parameters = new ParameterValue[1];

rpt.Parameters[0] = new ParameterValue();

rpt.Parameters[0].Label = "Month";

rpt.Parameters[0].Name = "Month";

rpt.Parameters[0].Value = Month;

其中:rpt.Parameters[0].Value必须使用RDL报表中参数实际使用的值

[03/29/2016]Updates:

在报表查看页面中可以点击右侧下拉菜单,点击其中的“Download...”,下载的RDL文件直接使用记事本可以找到参数的实际使用名称

Andy Yang

2014.03.20