水晶报表导出Excel多出空白页不完全解决方案

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 zlyperson 的 blog

在用水晶报表过程中,遇到凭空多出的白页,在csdn上查找,也发现两个帖子在问这个

问题,但没有得到合适的答案。于是自己摸索着,也找到一条方法,但感觉不是最完美

的,希望有精通于此道的朋友赐教,多谢。
csdn中类似问题贴:
http://community.csdn.net/expert/topic/3305/3305114.xml?temp=.8683435
http://community.csdn.net/expert/topic/3458/3458844.xml?temp=.7499506
http://community.csdn.net/expert/topic/3178/3178158.xml?temp=.637356
http://community.csdn.net/expert/topic/3248/3248381.xml?temp=.3554804
http://community.csdn.net/expert/topic/3138/3138593.xml?temp=.1768915
http://community.csdn.net/expert/topic/3203/3203522.xml?temp=.8826868
http://community.csdn.net/expert/topic/3178/3178028.xml?temp=.8597223
http://community.csdn.net/expert/topic/3467/3467509.xml?temp=.2149469
实际上这些问题贴子,感觉都没有得到一个完美的解答,我研究了一下发现问题的症结

在于,我们没有办法控制报表内容的宽度(内容宽度属性只读),在打印过程中也不会

多出空白页,只有在导出到excel文档时,用分页预览,我们可以发现,对应的每一页

右边都多出了一个空白页来,必须手动把页面调整过来,否则打印就会多出一倍的空白

页。事实上我们不可能做这么繁琐的事情,调整了excelformatoptions,调节导出后每

个列的固定宽度。具体如下:
   excelformatoptions excelformatopts = new

excelformatoptions();
   
   //' set the excel format options.
   excelformatopts.exceltabhascolumnheadings = false;
   excelformatopts.exceluseconstantcolumnwidth = true;
   excelformatopts.excelconstantcolumnwidth = 24.0;
   orpt.exportoptions.formatoptions = excelformatopts;
   orpt.exporttodisk(exportformattype.excel,

@"f:\leadbridge\tests\report.xls");
   orpt.close();
这样导出的excel发现excel内容列紧挨在一起,但导出的内容却是在一页的,打印的时候也是按实际页输出。不知道csdn以上贴主遇到的问题是不是一样的,希望对他们有所帮助。

本文关键:水晶报表导出Excel多出空白页不完全解决方案
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top