动态报告更改生成的目录的标题

发布于 2025-02-07 05:05:18 字数 1084 浏览 2 评论 0原文

这个问题可能不可能解决一个似乎没有人使用的工具,但是我们可以在这里使用。

我目前正在通过使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怼怹恏 2025-02-14 05:05:18

由于在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文