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

推荐订阅源

V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
V
V2EX
B
Blog RSS Feed
有赞技术团队
有赞技术团队
博客园 - Franky
美团技术团队
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
云风的 BLOG
云风的 BLOG
L
LangChain Blog
GbyAI
GbyAI
The Cloudflare Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Stack Overflow Blog
Stack Overflow Blog
博客园 - 【当耐特】
The Register - Security
The Register - Security
大猫的无限游戏
大猫的无限游戏
D
Docker
Vercel News
Vercel News
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
人人都是产品经理
人人都是产品经理
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
N
Netflix TechBlog - Medium
博客园_首页
A
About on SuperTechFans
J
Java Code Geeks
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
Recent Announcements
Recent Announcements
G
Google Developers Blog
小众软件
小众软件
博客园 - 叶小钗
WordPress大学
WordPress大学
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
F
Full Disclosure
Jina AI
Jina AI
H
Help Net Security

博客园 - Flymouse

Error CS0006 when invoking MSBuild from command line 一个Cookie引起的混乱 数据库错误:在执行批处理时出现错误。错误消息为: 目录名无效 NorthScale MemBase Server 1.6 的使用 使用网络目录映射虚拟目录出现 500.19 权限不足问题的一个解决办法 URL重写给 asp.net Ajax带来的问题 调整viewState的位置,有助于SEO C# Excel进程关闭 - Flymouse - 博客园 2个Excel异常处理 Win7 x64 IIS7支持32位应用程序 在.net中与mysql数据库的时候碰到显示不了中文字符的情况实现! 完美解决IFRAME中COOKIE、SESSION丢失 关于Ucenter在IIS中有时出现“Access denied for agent changed”错误。 如何將 Access 的 Memo 型態欄位匯入到 SQL2005 的 nvarchar 型態欄位 .net wap强制输出WML - Flymouse - 博客园 使用Extjs的Form无法输入的问题 jQuery滚屏代码,还有一点地方封装不进去 - Flymouse - 博客园 ASP.NET 2.0 中动态添加 GridView 模板列的例子 关于使用 jquery Validate 使用出现的问题
关于限制水晶报表的导出格式
Flymouse · 2010-04-08 · via 博客园 - Flymouse

最近有业务需求,在使用水晶报表时导出格式要求限制为PDF,但是水晶报表的reportviewer没有提供这样的选项,没有办法只好使用hack的水晶报表的到处对话框的方式来实现。

具体实现为找到 “\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer4\html\crystalexportdialog.htm” 文件,修改为以下代码:

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	</head>
	<body>
		<script language="javascript">
<!--
// export UI functions
function check(obj) {
	return !obj.disabled;
}

function toggleRangeFields(obj) {
	if( obj.id == "radio1") {
		document.Export.from.disabled = true;
		document.Export.to.disabled = true;
	}
	else {
		document.Export.from.disabled = false;
		document.Export.to.disabled = false;
	}
	return check(obj);
}

function checkDisableRange() {
	if( document.Export.exportformat.value == "CrystalReports"
		|| document.Export.exportformat.value == "RecordToMSExcel" ) {
		if( document.Export.isRange[1].checked ) {
			document.Export.isRange[0].checked = true;
		}
		document.Export.isRange[1].disabled = true;
		document.Export.from.disabled = true;
		document.Export.to.disabled = true;
	}
	else {
		document.Export.isRange[1].disabled = false;
	}
}

function isValidNumber(number) {
	var nonDigit = /\D+/;
	if( nonDigit.test(number) || number == '0' || number == "") {
		return false;
	}
	return true;
}

function checkValuesAndSubmit() {
	if( document.Export.isRange[1].checked ) {
		if (!isValidNumber(document.Export.from.value) || !isValidNumber(document.Export.to.value) || (parseInt(document.Export.from.value, 10) > 

parseInt(document.Export.to.value, 10))) {
			alert(parent.parent.opener.L_InvalidPageRange);
			return;
		}
	}
	if( document.Export.exportformat != null && document.Export.exportformat.selectedIndex == 0 ) {
		alert(parent.parent.opener.L_ExportFormat);
		return;
	}
	document.Export.action = opener.document.getElementById('crystal_handler_page').value;
	document.Export.submit();
}

function init() {
    document.getElementById ('radio1').focus ();
    if (document.getElementById('reportsource')) {
	    document.getElementById('reportsource').value = parent.opener.document.getElementById('crystal_print_rptsrc').value;
	}
	if (document.getElementById('viewstate')) {
	    document.getElementById('viewstate').value = parent.opener.document.getElementById('crystal_print_vs').value;
	}
}

document.write(parent.parent.opener.getExportDialog());

var formatselect=document.getElementById('exportFormatList');
formatselect.options.length = 0; 
formatselect.options[0]=new Option("格式","");
formatselect.options[1]=new Option("Acrobat 格式 (PDF)","PDF");
-->
		</script>
	</body>
</html>

重点就是

var formatselect=document.getElementById('exportFormatList');
formatselect.options.length = 0; 
formatselect.options[0]=new Option("格式","");
formatselect.options[1]=new Option("Acrobat 格式 (PDF)","PDF");


用这个替换掉了原来的格式选择框