简体   繁体   中英

Is it possible to wrap a text-block that does not contain whitespace?

I am building an XSL for transforming some internal data into a PDF report, and one of the elements is a block that contains user-typed text of a variable length. The issue is that in the unlikely but not impossible case of the text not containing any whitespace for long enough, that part of the text cannot wrap and will simply exit the block and the page itself on the right site. See this image for how it looks in the finished PDF. Is there any way to cause the text to forcibly wrap to the next line once it reaches the end of the blocks defined width?

This is the code segment in question:

<fo:table-row>
   <fo:table-cell column-number="1" number-columns-spanned="3">
      <fo:block>Text:</fo:block>
      <fo:block-container overflow="repeat">
         <fo:block border="solid 1pt" >
            <xsl:value-of select="text"/>
         </fo:block>
      </fo:block-container>
   </fo:table-cell>
</fo:table-row>

I have attempted the various parameters of the wrap-option and the overflow attributes, to no effect.

The usual answer for FOP is to insert a no-break space between characters so that FOP has somewhere to break.

See, eg, How to force wrap on table entries

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM