XSL-FO fop. Long text flows into adjacent cells/block, obscuring stuff there
Could anyone suggest me a way to make long words (like serial numbers) to be wrapped? I tried some commercial software and there is no such issue. Is it a fop bug or probably there is a solution available?
I can't insert zero length space after each character of every word in document. This solution sounds insane for me.
You can specify the wrap-option attribute in your
fo:block like so:
<fo:block wrap-option="wrap"> ... stuff </fo:block>
Here's the XSL-FO specification for this attribute:
Value: no-wrap | wrap | inherit
Applies to: fo:block, fo:inline, fo:page-number, fo:page-number-citation
Values have the following meanings:
No line-wrapping will be performed.
In the case when lines are longer than the available width of the content-rectangle, the overflow will be treated in accordance with the "overflow" property specified on the reference-area.
Line-breaking will occur if the line overflows the available block width. No special markers or other treatment will occur.
Specifies how line-wrapping (line-breaking) of the content of the formatting object is to be handled.
Implementations must support the "no-wrap" value, as defined in this Recommendation, when the value of "linefeed-treatment" is "preserve".
You can also define the
wrap-option attribute in an
<fo:table-cell wrap-option="wrap"> ... </fo:table-cell>
fo:blocks within will inherit the property.
PDF/FO table cell wrap long words · Issue #142 · plutext/docx4j , You can specify the wrap-option attribute in your fo:block like so: <fo:block wrap-option="wrap"> stuff </fo:block>. Here's the XSL-FO specification for this 3.8. Text overflowing table cells and the like is not clipped. Long text flows into adjacent cells/block, obscuring stuff there.¶ Since the overflow property doesn't apply to table-cell, you can wrap the cell content in a block-container and specify overflow="hidden" there. Alternatively, if you have long words overflowing table cells, try to
Zkoh's answer (wraping) will help you only if the text contains multiple words split by white spaces. In case of long words (as mensioned in question), hyphenation is way to go (as Daniel suggested).
There can be quite a few problems with hyphenation in FOP:
- FOP is using hyphenation algorithms from TeX and because of some licencing issues, those algorithms (at least for some languages) are not part of standard FOP binary distribution (as stated here) and must be downloaded separately from OFFO web site. There are two kinds of hyphenation pattern files on the website. XML format (which needs to be compiled 1st to be used with FOP) and JAR file (already compiled). Be sure to download compiled version! Installation is straightforward and well documented - just drop the OFFO binary into FOP's lib folder and thats it...
- Don't forget to specify language of your document and if needed, enable hyphenation on block level (its inherited so add it to the root element and you should be fine) - see FOP FAQ
[PDF] FOP FAQ, GitHub is home to over 50 million developers working together to http://stackoverflow.com/questions/4350788/xsl-fo-force-wrap-on-table-entries /xsl-fo-fop-long-text-flows-into-adjacent-cells-block-obscuring-stuff-there Long text flows into adjacent cells/block, obscuring stuff there. ^ Clipping as specified by the overflow="hidden" is not yet implemented. If you have long words overflowing table cells, try to get them hyphenated.
Would hyphenation solve your problem? You should be able to enable hyphenation with a
hyphenate="true" attribute. Placement of this attribute will depend on where you want to enable hyphenation.
Here's a link to FOP's hyphenation compliance: Apache FOP Compliance Page
Here's a link to the XSL spec: XSL Spec #hyphenate
If not, you may need to experiment with some keeps properties (like
FOP FAQ - Apache XML Graphics, Could anyone suggest me a way to make long words (like serial numbers) to be wrapped? I tried some commercial software and there is no such issue. Long text flows into adjacent cells/block, obscuring stuff there. Clipping as specified by the overflow="hidden" is not yet implemented. If you have long words overflowing table cells, try to get them hyphenated. Artificial names like product identifications or long numbers usually aren't hyphenated.
Use keep-together.within-column="always" instead of keep-together="always" of to keep long lines with in table cell.
Disposition of Comments on XSL Recommendation, Long text flows into adjacent cells/block, obscuring stuff there. (XML) There are complaints about illegal characters and entities in the input.18 FOP provides both an application and a library that converts an XSL FO document Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
The question is about serial numbers, not about dictionary words. Specifying
hyphenate="true" is useful only when the hyphenation dictionary or hyphenation algorithm can successfully hyphenate the words in the text. Serial numbers would rarely generate sequences that can usefully be hyphenated as if they are words.
You can, of course, use XSLT to add zero-width spaces in text in table cells rather than doing it manually. StackOverflow likes duplicate questions (see https://stackoverflow.blog/2010/11/16/dr-strangedupe-or-how-i-learned-to-stop-worrying-and-love-duplication/), but, all the same, please see the answers in XSL-FO: Force Wrap on Table Entries.
How to wrap text in a table cell with xslt, FOP is distributed with Cocoon as a PDF serializer for XSL (FO) documents. XML Graphics Long text flows into adjacent cells/block, obscuring stuff there.¶. The FOP command line application can be directly used to transform XML into PDF, PostScript, PCL and other formats, there is also an AWT based viewer integrated. The library can be used in servlets and other Java applications.
FOP FAQ. 1. Questions. 1. General questions What is FOP? What , This document includes XSL-FO related comments that have been resolved by the Item 2: Explanation of XSL spec; Comment 34: Spanned cells pending beyond the flow-to-area model that would satisfy the requirements of a large number of orange border is adjacent to and inside of the block container's red border. The XML data on the left is formatted into the two pages on the right. The document contains static areas that appear on every page, an external graphic, a footnote on the first page, and a table that goes across both pages. FOP uses the standard XSL-FO file format as input, lays the content out into pages, then renders it to the requested output.
One option would be for you to break up the long number/word in XSLT while you 're XSL-FO fop. Long text flows into adjacent cells/block, obscuring stuff there. I use Excel to list my inventory for an online auction site. When you type in text that is longer than the width of the cell (say,cell B2), the text will spill over into the adjacent cell (B3) if
Long text flows into adjacent cells/block, obscuring stuff there. General questions regarding XSLT, XSLFO, and basic XML (FO) How do I vertically center an When you type a long text string in a cell, the cell context will overflow to next cell. If you enable wrapping text for this cell, the row height will be changed automatically with the typing text. However, sometimes you may need to prevent cell content from overflowing to other cells without affecting row height.