学会JasperReport报表导出以后再也难不倒我们了

学会JasperReport报表导出以后再也难不倒我们了,第1张

一个空的模板页,有类似html的title detail等元素

本节主要讲解模板设计中如何放置模板元素达到我们想要的效果,涉及到模板元素的使用,如detail,column header等,下面将一一讲解outline中各个自带元素的使用

Tille

标题 Title在第一页中显示,而第二页和第三页都不会再显示,所以Title只会显示一次。

Detail

则是要放置填充数据的位置,因为它会加载多次,有多少条数据就会加载多少次,保证了数据可以全部显示出来。

Page Header

顾名思义,页的头部,应该就是我们所说的页眉,我们的word文档一般都会有页眉, Page Header会在每一页都加载一次,与Detail作用一致

Column Header &Column Footer

首先看名字,表头与表尾,作用与Page Header应该相差无几,都是提示文字,表头可以放表格里列的名字,表尾可以放一些数据的总结概括等等。

在Column Header 和 Column Footer各自放置两段Static Text,然后进行预览。

Page Footer

有了页眉,自然有对应的页脚。一般页脚的作用都是用于显示页数的

Last Page Footer

Page Footer是没法显示最后一页的。幸好还有一个元素,Last Page Footer,这个元素就是用以最后一页页脚的

Summary

Summary是数据显示完之后用以总结的,并且会出现在Detail表格下方

No Data

不知道是干什么的

Background

Background应该是报表的背景

This is the first section of the report. It is generated only once during the report-filling

process and represents the beginning of the resulting document.

The title section precedes even the page header section. To print the page header before

the title section, put the elements on the page header at the beginning of the title section

as well. You can suppress the actual page header on the first page using the

《printWhenExpression》, based on the PAGE_NUMBER report variable.

As described in “Report Template Properties” on page 42, the title section can be

followed by a page break if the isTitleNewPage attribute is set to true.

This section appears at the top of each page in the generated document.

This section appears at the top of each column in the generated document.

For each record in the data source, the engine tries to generate this section. The detail

section can be made of multiple bands.

This section appears at the bottom of each column in the generated document. It never

stretches downward to acquire the content of its containing text fields. Its rendering

position is controlled by the isFloatColumnFooter flag declared at report template

level.

This section appears at the bottom of each page in the generated document. Just like the

column footer section, the page footer never stretches downwards to acquire the content

of its containing text fields and always retains the declared fixed height.

This section is generated only once per report and appears at the end of the generated

document, but is not necessarily the last section generated. This is because in some cases

the column footer and/or page footer of the last page follows it.

As mentioned in “Report Template Properties” on page 42, you can have the summary

section start a new page of its own by setting the isSummaryNewPage attribute to true.

Even if this attribute remains false, the summary section always starts a new page if it

does not fit on the remaining space of the last page, or if the report has more than one

column and it has already started a second column on the last page.

If present, this section replaces the normal page footer section, but only on the last

occurrence of the page footer, which might not be the last page if the summary is present

and it overflows on multiple pages or it is rendered alone on its own last page. So it

behaves more like the last page footer than the footer of the last page.

This is a special section that is rendered on all pages and its content placed underneath

all other report sections. Normal report sections are rendered one after the other, but the

background section does not interfere with the other report sections and can be used to

achieve watermark effects or to create the same background for all pages.

If the main report sections described here don’t meet your needs, you might consider

introducing supplementary sections like group headers and group footers.

The following section shows how to group data on the report.

This is another special section that is generated only once per report and, under certain

conditions, its content will replace all the ordinary report’s content.

Sometimes when the report data source is empty, is very useful to generate an equivalent

content, a notice, maybe, or an image, in order to replace all the empty zone. Especially

in the case of subreports, more useful is to replace all the subreport’s content with an

equivalent one.

If the ‘noData’ section is defined in the report template, and if the data source is empty,

then the ’noData‘ section will be the only one taken into account at fill time, and its

content will produce the report output.

一个简单的柱状图, 怎么配置属性呢 在图表右键选择Edit Chart Wizard

Series

代表x轴每一个所对应的柱子个数, 也就是红蓝青三条柱子, 如果想要更多点击右侧...选择add即可

Category

x轴显示的值

Value

自然就是数量了

Label

单词意思是标签, 但是加了没发现有什么用不加会报错

X轴如何倾斜

点击图表在右侧Properties中找到 Chart Plot >Category Axis Tick Label Rotation 选择倾斜角度即可

大家都知道在数据量大的情况下x轴如果不倾斜一个个字挤的可是很难看的, 话说我也是找了好久才找到这个属性

最后要注意的一点

必须为这两个选项下的所有Font标签设置字体不然中文可是无法显示的,  就像这样

PDF显示中文问题项目中配置, PDF显示中文问题传送门

jasperreports_extension.properties

此人博客有更详细jasper教程

JasperReports是一个非常流行的开源报表工具 制作报表三个步骤:1)定制报表格式。 有二种方式,一种就是写jrxml文件,其实就是xml文件,只不过是后缀名不一样罢了。 JasperReports的模板文件是一个后缀名为jrxml的xml文件, 它包含这样几个主要元素: <jasperReport>根元素 <title>标题 <pageHeader>页头 <detail>具体内容 <pageFooter>页尾 <band>作为以上元素的子元素, 用来定义报表区域 除了jasperReport之外, 其他元素都不是必须的 另一种方式更直接,就是生成一个JasperDesign类的实例,在japsperDesign中自己定义模板。jrxml文件也是通过一个JRXmlLoad加载过来,转成JasperDesign类的实例。也就是说写jrxml文件还需要进行解析,加载。现实中我们使用的报表一般格式比较固定,因而可以通过先使用iReport工具生成模板,再加载解析的方式。这种方式简单,而且可见性强。

%Generate signal and set threshold.

y = linspace(-1,1,100)

subplot(311)

plot(y)title('原始线')

thr = 0.5

% Perform hard thresholding.

ythard = wthresh(y,'h',thr)

subplot(312)

plot(ythard)title('硬阈值线')

% Perform soft thresholding.

ytsoft = wthresh(y,'s',thr)

subplot(313)

plot(ytsoft)title('软阈值线')


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11269743.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存