搜索文章

推荐内容

快逸做的更好

产品优势

您的位置: 首页 > 报表技术分享 > 填报表中使用固定表头属性时的几个问题

填报表中使用固定表头属性时的几个问题

在实际应用中,我们经常遇到一些数据量很多的报表,这类报表往往带有表头,当拖拽报表时,想让表头锁定住,这样的效果类似于excel中的锁定表头。

锁定表头的使用方法:

<report:html name="report1" srcType="file" reportFileName="api/wangge.raq" scrollWidth="300" //滚动区域宽度 needScroll="yes" //是否需要滚动 scrollHeight="200" //滚动区域高度 scrollBorder="border:1px solid red" //滚动区域边框 />
在使用锁定表头时,需要注意几点:
1、如果scrollWidth和scrollHeight采用百分比的格式,那么滚动区域的高度和宽度是根据jsp中报表外面的元素的高度和宽度而定的,如果报表外面的元素没有指定高度和宽度,可能会出问题。 
举例如下,在自定义的jsp中,首先定义在报表外面table元素的width和height,这样可以保证滚动区域正常显示。
<table style="width:40%; height:80%;overflow:hidden;table-layout:fixed">
<tr><td valign=top>
<report:html name="report1" reportFileName="<%=file%>"
needScroll="yes"
scrollWidth="80%"
scrollHeight="50%"
......
/>
</td></tr></table>


2、当报表设置了scrollWidth和scrollHeight时,如果想让报表居中,会发现失效,这时要把table的宽度设置成和scrollWidth一致才可以。
<table align="center" width=350 height=100%>
<tr><td>
<report:html name="report1" reportFileName="初级教程/7.3.raq"
needPrint="yes"
needScroll="yes"
scrollWidth="350"
scrollHeight="500"
/>
</td></tr>
</table>

3、如果既要分页又要固定表头怎么做呢?这要用到标签中的一个属性:needPagedScroll="yes"

分页后,表头继续固定:



本文标签: