资源预览内容
第1页 / 共7页
第2页 / 共7页
第3页 / 共7页
第4页 / 共7页
第5页 / 共7页
第6页 / 共7页
第7页 / 共7页
亲,该文档总共7页全部预览完了,如果喜欢就下载吧!
资源描述
第四章 报表设计 “报表设计(report design)”是一个模板,JasperReports 引擎会用它来传递动态内容到打印机,屏幕或者是Web页面。存储于数据库中的数据会根据报表的实际设计来填充整个报表,打印到页面导向的文档。The report design represents a template that will be used by the JasperReports engine to deliver dynamic content to the printer, to the screen or to the Web. Data stored in the database is organized during the report filling process according to this report design to obtain ready to print, page oriented documents.通常,一个“报表设计”包含了关于数据填充后所形成的报表(documents)的结构和所有的其他方面的信息。这些信息包括将要输出到报表上的各种文本,图像元素的位置,内容,以及要进行的数据计算,自定义计算,分组,操作等信息。Generally speaking, a report design contains all the information concerning the structure and the aspect of the documents that will be generated when the data will be provided. This information concerns the position and the content of various text or graphic elements that will appear on the document, their appearance, the custom calculations, data grouping and data manipulation that should be performed when generating the documents, etc.一般,“报表设计(report design)”用一种特殊的结构定义在Xml文档中(我们会在稍后详细分析),在被填充数据前,这一过程属于JasperReports 报表的编辑阶段。但是“报表设计(report design)”也可以用JasperReports API 以编程的方式在内存中构造.随JasperReports 项目源文件一起提供了一个 noxmldesign(No Xml Design) 例子介绍了如何直接在内存中创建“报表设计(report design)”,而不用编辑Xml 文档。Normally, the report designs are defined in XML files with a special structure that we shall see in detail later and are subject to the JasperReports compilation process before being filled with data. But they also can be constructed in-memory, programmatically, using the JasperReports API. There is a sample called noxmldesign shipped with the JasperReports project source files that shows how to directly create in-memory report designs, without editing any XML files at all.4.1 DTD 文件引用用Xml 文档来编辑“报表设计(report design)”时,JasperReports 用它自己内部专用的DTD 文件来校验这个文档内容。如果XML 校验通过,那表示这个XML “报表设计(report design)”符合 JasperReports 所需要的XML 文档结构和语法,JapserReports 引擎也可以编译这个文档来输出“已编译”的“报表设计(report design)”.When working with XML report designs, JasperReports uses its own internal DTD files to validate the XML content it receives for processing. If the XML validation is passed, it means that the supplied report design corresponds to the JasperReports required XML structure and syntax and the engine is able to generate the compiled version of the report design.正确的Xml“报表设计”通常标明用于校验它本身的JasperReports 内部专用的DTD文件。如果不标明引用这个文件,报表编译便会失败。这个应该不复杂,因为这个引用在每个“报表设计(report design)“里通常都是一样,你只要简单的复制他就行了。初始设计报表,你可以从本书的例子 里复制。 Valid XML report designs always point to the JasperReports internal DTD files for validation. Without the DTD reference specified, the report compilation process fails abruptly. This should not be considered a too much burden for anybody since the DTD reference is always the same and can simply be copied from previous report designs. At the beginning you will copy it from the supplied samples.前面已经说过,Jasper reports 引擎只认识指向它内部DTD文件的引用,所以大虾你不要从library 源文件里另外拷贝一个DTD文件放到别的所在,然后在你的“报表设计“里指向它-做外部引用。如果你预谋这样做,你还得修改一些library Classes,包括 类。As already mentioned, the engine recognizes only the DTD references that point to its internal DTD files. You cannot make a copy of the DTD files found among the library source files and point to that copy in your XML report designs. If you want to do that, you will also have to alter the code of some of the library classes including the dori.jasper.engine.xml.JRXmlDigester class.如果“小强”你有福遇到了说 JasperReport 引擎由于资源载入问题找不到它自己内部DTD专用文件,确认排除一切可能的错误后再做外部DTD文件引用-做“强人”。不过遇到这样错误的机率很小,因为library资源载入机制已经作了优化。If you ever encounter problems such as the engine not finding its own internal DTD files due to some resource loading problems, make sure you have eliminated every possible cause before deciding to use external DTD files. Encountering such a problem is very unlikely since the resource loading mechanism of the library was improved with time.在XML”报表设计”里,有两种方式的DTD文件引用,它们是:或者是XML“报表设计”的根元素是,下面是一个普通的XML文件形式的“报表设计”:。第一个连续的3个点号是放报表的属性和设置的,另外3个点号是放各种“报表设计”元素的如:parameters,fields,variables,groups,sections, 等。我们会在接下来的几章里详细分析它们。The first 3 points make it for the report design properties and settings and the other 3 for the suppressed various report design elements such as report parameters, fields, variables, groups, report sections, etc. We shall see all of them in detail in the following chapters of this book.42 XML 编码 使用不同种类的语言设计报表时,大哥你一定要注意你报表里的语言编码要符合XML 文件头部的encoding属性所指定的编码。如果不指定的话,默认的就是“UTF8”编码。When creating XML report designs in different languages
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号