水平拉伸 CrossTab 的单元格
如何让值单元格[在 CrossTab 小部件中]水平拉伸,而不是垂直拉伸?溢出时拉伸会垂直拉伸单元格,而不是水平拉伸。
How would I get a value cell [in a CrossTab widget] to stretch horizontally, rather than vertically? Stretch on overflow stretches the cell vertically, rather than horizontally.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
背景
如果我没记错的话,JasperReports 中的单元格既没有设计也没有实现为水平拉伸。这是首席开发人员做出的有意识的决定。
您可以通过根据数据的宽度生成交叉表单元格来使它们拉伸(仅这句话就应该让您了解创建此问题的通用解决方案的范围)。这是可能的,但需要使用 JasperReports API 创建您自己的类。
假设您有 100,000 行数据,并希望单元格自动适应最长的字符串。 JasperReports 必须执行以下两件事之一:
然后你必须回答有关空白的问题:修剪还是不修剪?如果报告软件对其进行修剪,则返回的数据就不能真实表示数据库中的信息。如果数据没有被修剪,那么就会引发更多问题(例如看起来“空”的意外超长列)。或者你可以让它成为开发人员需要做的另一件事。
这不是一个小问题。
替代方案
尝试DynamicJasper。
Background
If I recall correctly, cells in JasperReports were neither designed nor implemented to stretch horizontally. This was a conscious decision made by the lead developers.
You can make them stretch by generating the cross-tab cells according to the width of the data (that sentence alone should give you a feel for the scope of creating a generic solution to this problem). It is possible, but would involve creating your own class using the JasperReports API.
Imagine you have 100,000 rows of data and want the cell to auto-fit to the longest string. JasperReports would have to do one of two things:
Then you have to answer questions about white space: trim or not to trim? If the reporting software trims it, then the data coming back isn't a true representation of the information in the database. If the data isn't trimmed, then that cascades to more problems (such as unexpectedly super-long columns that look "empty"). Or you can make it one more thing that the developer needs to do.
It is not a trivial problem.
Alternatives
Try DynamicJasper.