动态报告更改生成的目录的标题
这个问题可能不可能解决一个似乎没有人使用的工具,但是我们可以在这里使用。
我目前正在通过使用 dynamiCreports 本身基于jasperReports。
主要报告是由各种子报告生成的,其中作为目录在开始时生成的目录
JasperReportBuilder report = report();
TableOfContentsCustomizerBuilder customTOC = new TableOfContentsCustomizerBuilder();
customTOC.setTitleStyle(ReportStyles.BOLDSTYLE);
report
.setTemplate(Base.createTemplate())
.tableOfContents(customTOC)
.setDataSource(new JREmptyDataSource());
中,这将导致像这样的内容表:
Table of Contents
Page1 ……………………… 1
Page2 ……………………… 2
Page3 ……………………… 3
我想知道是否有一种方法或黑客更改“目录”字符串的方法或黑客,因为生成的PDF不使用英语。更改语言环境也不会更改标题标题。
感谢提前的任何帮助。
编辑:由于 https://github.com/dynamicreports 发现通过简单地覆盖定制器来易于解决。因此,这个问题主要源于我作为软件开发人员的经验。
对于任何找到此帖子的未来人,只需扩展超级班级contofcontentscustomizer并覆盖标题();方法。您可以将文本组件设置为您想要的任何东西。
This problem may be an impossibility to solve for a tool that no one seems to use but alas here we go.
I am currently in the process of generating a PDF file through the use DynamicReports that itself is based on JasperReports.
The main report is generated with various subreports,where as a table of contents is generated in the beginning
JasperReportBuilder report = report();
TableOfContentsCustomizerBuilder customTOC = new TableOfContentsCustomizerBuilder();
customTOC.setTitleStyle(ReportStyles.BOLDSTYLE);
report
.setTemplate(Base.createTemplate())
.tableOfContents(customTOC)
.setDataSource(new JREmptyDataSource());
This results in a table of contents that looks like this:
Table of Contents
Page1 ……………………… 1
Page2 ……………………… 2
Page3 ……………………… 3
I wondered if there is a way or hack to change the „Table of Contents“ string, as the generated PDF is not in English. Changing the locale doesn‘t change the heading title either.
Thanks for any assistance in advance.
EDIT: Due to the repository found under https://github.com/dynamicreports I could further look into it and found it easy to solve by simply overriding the Customizer. This problem thus stemmed largely from my own inexperience as a software developer.
For any future people who find this post, simply extend the super class TableOfContentsCustomizer and override the title(); method. There you can set the text component to be anything you desire.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于在 https://github.com/dynamicreports 通过简单地覆盖定制器来易于解决。因此,这个问题主要源于我作为软件开发人员的经验。
对于任何找到此帖子的未来人,只需扩展超级班级contofcontentscustomizer并覆盖标题();方法。您可以将文本组件设置为您想要的任何东西。
Due to the repository found under https://github.com/dynamicreports I could further look into it and found it easy to solve by simply overriding the Customizer. This problem thus stemmed largely from my own inexperience as a software developer.
For any future people who find this post, simply extend the super class TableOfContentsCustomizer and override the title(); method. There you can set the text component to be anything you desire.