5

Just to make sure I would like to share my understanding of FOP vre 1.0 with you, FOP uses a automated line breaking algorithm i.e when data overflows the width of a table cell,FOP looks for white space in the data and if it finds a white space,then it wraps the data that overflows from the nearest white space into next line of that cell.

But what if the data don't has a white space,then then FOP is not able to wrap data. This is the problem I'm facing.

I write this code.

<fo:table-cell border="solid">
<fo:block hyphenate="true" language="en" wrap-option="wrap">
<xsl:value-of select="welcomeMsg"></xsl:value-of>
</fo:block>
</fo:table-cell>

but it overflows from table cell,instead of wraping because the welcomeMsg is a long string with no white spaces in between.I need the welcomeMsg to be wrapped inside table cell.

Cœur
  • 37,241
  • 25
  • 195
  • 267
krishna singh
  • 73
  • 1
  • 7
  • Can you give an example of the `welcomeMsg`? Also, do you have any keep rules higher up in the table that might be breaking your hyphenation? – Daniel Haley Sep 29 '11 at 15:27
  • Also, are you using XSLT 2.0? – Daniel Haley Sep 29 '11 at 15:36
  • If you want it to break the long string, do you want hyphenation when it is broken, or just to split the string? Are there any patterns to the string where breaks would be preferred? – Mads Hansen Sep 29 '11 at 16:19

1 Answers1

3

Apache FOP implements the Unicode UAX #14 algorithm for line breaking. So, if a word (or loooong number) cannot be broken and therefore overflows a table-cell, it's because of that algorithm. The usual work-around is to insert zero-width spaces (&#x200B;) into fields that you know could cause overflows. This can easily be done via XSLT. See also: How to force wrap on table entries

Moritz
  • 1,954
  • 2
  • 18
  • 28
Jeremias Märki
  • 1,727
  • 10
  • 10