XSL-FO:在表格单元格中包装长词 [英] XSL-FO: wrapping long words in table cell

查看:35
本文介绍了XSL-FO:在表格单元格中包装长词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Docbook-XSL 和 Apache FOP 来生成包含表格的 PDF 文档.在默认设置下,表格具有固定宽度的列和行在字边界处换行.但是如果一个字长于单元格宽度,它就会溢出单元格.在这种情况下,我想将单词分成多行.这怎么可能?

I'm using Docbook-XSL and Apache FOP to generate PDF documents containing tables. With the default settings, tables have fixed-width columns and lines wrap at word boundaries. But if a word is longer than the cell width, it overflows the cell. I'd like to break up the words across multiple lines in such a case. How could this be done?

连字符不是解决方案,因为单词不必是英文.(其他语言中的连字符也不是解决方案.可能无法提前知道数据是什么语言,并且可能存在无法连字符的单词",例如数字字符串.)

Hyphenation is not a solution since the words need not be in English. ( hyphenation in other languages is not a solution either. It may not be known ahead of time what language the data is in, and there may be "words" that cannot be hyphenated, such as numeric strings.)

我发现对 fo:table-row 使用 keep-together.within-column="always" 的建议,但似乎没有任何建议效果.

I found suggestions to use keep-together.within-column="always" for fo:table-rows, but that didn't seem to have any effect.

()另一个建议是在所有字符之间插入零宽度空格.但这也会在词中打破短词.我需要一个尽可能在单词边界处中断的解决方案,并且仅在需要时才插入中间词.

() Another suggestion was to insert zero-width spaces between all characters. But this also breaks short words mid-word. I would need a solution that breaks at word boundaries whenever possible, and mid-word only when needed.

推荐答案

FOP 与几乎所有 FO 处理器一样,可以连接英语以外的语言.请参阅 http://xmlgraphics.apache.org/fop/2.1/hyphenation.html

FOP, like just about every FO processor, can hyphenate languages other than English. See http://xmlgraphics.apache.org/fop/2.1/hyphenation.html

您可以尝试使用 FO 处理器,例如 Antenna House AH Formatter,它实现了自动"表格布局,并且可以根据文本可能中断的位置调整表格列的宽度(以及对多种语言进行连字符).

You could try using an FO processor, such as Antenna House AH Formatter, that implements 'auto' table layout and can adjust the widths of the table columns depending on where the text can break (as well as do hyphenation for multiple languages).

在表格单元格中打断文本的其他答案位于:

Other answers for breaking text in table cells are at:

这篇关于XSL-FO:在表格单元格中包装长词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆