XSL-FO:表布局调整

发布于 2024-09-11 19:23:42 字数 1739 浏览 2 评论 0原文

这是我的问题,我有一个像这样的表

This is a column header (A)  | Another Column header (B) | Header (C) | Another column Header (D)
--------------------------------------------------------------------------------------------------
Value A                      | Value B                   |  Value C   | Value D

,问题是,A 和 C 列中的值可能很长,而 B 和 D 中的值可能很短。我不介意标题或值是否换行 - 所以理想情况下,我希望一个典型的表格如下所示本质上

This is a column header (A)             | Another       | Header (C)                        | Another 
                                        | Column        |                                   | column 
                                        | header (B)    |                                   | Header (D)
----------------------------------------------------------------------------------------------------------
Value is very long and verbose, bla bla | Value B       | Value C - this to is quite long   | Value D
bla bla bla - see it wrapped            |               |                                   |

,我希望列标题优先换行到表格数据单元格。我不能简单地将 wrap-option="no-wrap" 属性应用于表格单元格 - 因为页面不够宽,无法容纳所有长文本。

我尝试为列指定 proportional-column-width 属性 - 但这并不理想,因为我不知道哪些列在所有情况下都将包含最长的文本。

我目前提出的最佳解决方案是在列标题文本中显式放置换行符,但这会带来不必要的副作用,即它似乎会增加相当多的列宽。请参阅http://snipplr.com/view/37957/xslfo-以-make-a-table/为例。这会产生此输出 http://imagebin.org/106996 。请注意,第 3、4、5、6 和 7 列似乎具有相当大的填充,这意味着第 1 列和第 2 列比应有的要窄。

任何帮助将不胜感激。

PS - 我正在使用 Ibex 渲染引擎 http://www.xmlpdf.com

Here is my problem, I have a table like this

This is a column header (A)  | Another Column header (B) | Header (C) | Another column Header (D)
--------------------------------------------------------------------------------------------------
Value A                      | Value B                   |  Value C   | Value D

The thing is, the values in columns A and C, say can be very long whereas the values in B and D can be very short. I don't mind if the headers or the values wrap - so ideally I would like a typical table to look like the following

This is a column header (A)             | Another       | Header (C)                        | Another 
                                        | Column        |                                   | column 
                                        | header (B)    |                                   | Header (D)
----------------------------------------------------------------------------------------------------------
Value is very long and verbose, bla bla | Value B       | Value C - this to is quite long   | Value D
bla bla bla - see it wrapped            |               |                                   |

Essentially, I would like the column headers to wrap in preference to the values in the table data cells. I cannot simply apply the wrap-option="no-wrap" attribute to the table cells - as the page is not wide enough to accommodate all the long text.

I have tried specifying proportional-column-width attribute to the columns - but this is not ideal as I don't know which columns will contain the longest text in all circumstances.

The best solution that I have come up with at the moment, is to explicitly put line breaks in the column header text but this has the unwanted side effect that it seems to increase the column width a fair amount. See http://snipplr.com/view/37957/xslfo-to-make-a-table/ for an example. This produces this output http://imagebin.org/106996 . Note how columns3, 4, 5, 6 and 7 seem to have rather generous padding, which means that columns1 and 2 are narrower than they could be.

Any help would be greatly appreciated.

PS - I am using the Ibex rendering engine http://www.xmlpdf.com

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

浊酒尽余欢 2024-09-18 19:23:43

我不确定您使用的是哪种渲染引擎。但如果它支持 table-layout="auto" (大多数商业引擎都支持),这可能会给您带来比现在更好的结果。没有任何明确的换行符。

请参阅表格布局属性的 XSL 规范和相应的CSS2 规范

I'm not sure which rendering engine you're using. But if it supports table-layout="auto" (which most commersial engines does) this might give you a better result than the result you get now. Without any explict line breaks.

See the XSL specification for table-layout property and the corresponding CSS2 specification.

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