You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by SanjeevGour <sa...@gmail.com> on 2008/07/10 08:29:15 UTC
How to wrap text in fo:table-cell
Hello,
I am generating a PDF using FOP. I have table which contains large text in
cells. This text goes into the next column messing up the data. Following is
my xsl -
<fo:table-cell padding="2pt" border="0.2pt solid black" width="auto">
<fo:block-container width="60px" height="10px"
overflow="scroll">
<fo:block>
tttttttttttttttttttttttttttttttttnnntttnttttttttttttttttt
</fo:block>
</fo:block-container>
</fo:table-cell>
This text wrap correctly when it has spaces in between. That to happens
without using fo:block-container. I want when the text is large, it should
continue with the next line. I don't know what value to specify and which
attributes need to be set for fo:block-container in order to do this.
Any guidelines would be highly appreciated.
Thank you,
Sanjeev.
--
View this message in context: http://www.nabble.com/How-to-wrap-text-in-fo%3Atable-cell-tp18376733p18376733.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: How to wrap text in fo:table-cell
Posted by SanjeevGour <sa...@gmail.com>.
Just to add a note that I could resolve this problem using zero width spaces-
I used the following xsl to add zero width space after each character-
<xsl:template name="zero_width_space_1">
<xsl:param name="data"/>
<xsl:param name="counter" select="0"/>
<xsl:choose>
<xsl:when test="$counter < string-length($data)">
<xsl:value-of select='concat(substring($data,$counter,1),"​")'/>
<xsl:call-template name="zero_width_space_2">
<xsl:with-param name="data" select="$data"/>
<xsl:with-param name="counter" select="$counter+1"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="zero_width_space_2">
<xsl:param name="data"/>
<xsl:param name="counter"/>
<xsl:value-of select='concat(substring($data,$counter,1),"​")'/>
<xsl:call-template name="zero_width_space_1">
<xsl:with-param name="data" select="$data"/>
<xsl:with-param name="counter" select="$counter+1"/>
</xsl:call-template>
</xsl:template>
and then placing a call to zero_width_space_1 like following-
<xsl:call-template name="zero_width_space_1">
<xsl:with-param name="data" select="span"/>
</xsl:call-template>
Now fop wraps the text to new line once it reaches the cell border.
Thanks for all your guidelines.
Sanjeev Gour.
Jeremias Maerki-2 wrote:
>
> This is an FAQ. Please see:
> http://xmlgraphics.apache.org/fop/faq.html#cells-overflow
>
> There are a number of posts about this on the mailing list archives, too.
> Good luck!
>
> BTW, overflow="scroll" doesn't have an effect in FOP!
>
> On 10.07.2008 08:29:15 SanjeevGour wrote:
>>
>> Hello,
>> I am generating a PDF using FOP. I have table which contains large text
>> in
>> cells. This text goes into the next column messing up the data. Following
>> is
>> my xsl -
>> <fo:table-cell padding="2pt" border="0.2pt solid black" width="auto">
>> <fo:block-container width="60px" height="10px"
>> overflow="scroll">
>> <fo:block>
>> tttttttttttttttttttttttttttttttttnnntttnttttttttttttttttt
>> </fo:block>
>> </fo:block-container>
>> </fo:table-cell>
>>
>> This text wrap correctly when it has spaces in between. That to happens
>> without using fo:block-container. I want when the text is large, it
>> should
>> continue with the next line. I don't know what value to specify and which
>> attributes need to be set for fo:block-container in order to do this.
>>
>> Any guidelines would be highly appreciated.
>>
>> Thank you,
>> Sanjeev.
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-wrap-text-in-fo%3Atable-cell-tp18376733p18376733.html
>> Sent from the FOP - Users mailing list archive at Nabble.com.
>>
>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/How-to-wrap-text-in-fo%3Atable-cell-tp18376733p18382089.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: How to wrap text in fo:table-cell
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
This is an FAQ. Please see:
http://xmlgraphics.apache.org/fop/faq.html#cells-overflow
There are a number of posts about this on the mailing list archives, too.
Good luck!
BTW, overflow="scroll" doesn't have an effect in FOP!
On 10.07.2008 08:29:15 SanjeevGour wrote:
>
> Hello,
> I am generating a PDF using FOP. I have table which contains large text in
> cells. This text goes into the next column messing up the data. Following is
> my xsl -
> <fo:table-cell padding="2pt" border="0.2pt solid black" width="auto">
> <fo:block-container width="60px" height="10px"
> overflow="scroll">
> <fo:block>
> tttttttttttttttttttttttttttttttttnnntttnttttttttttttttttt
> </fo:block>
> </fo:block-container>
> </fo:table-cell>
>
> This text wrap correctly when it has spaces in between. That to happens
> without using fo:block-container. I want when the text is large, it should
> continue with the next line. I don't know what value to specify and which
> attributes need to be set for fo:block-container in order to do this.
>
> Any guidelines would be highly appreciated.
>
> Thank you,
> Sanjeev.
> --
> View this message in context: http://www.nabble.com/How-to-wrap-text-in-fo%3Atable-cell-tp18376733p18376733.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: How to wrap text in fo:table-cell
Posted by SanjeevGour <sa...@gmail.com>.
Thanks for your response. I thought there might be some value for overflow
attribute which can handle this. Can you give me some idea about how to
insert zero width spaces using a xsl function?
Thanx.
Sanjeev.
Vincent Hennebert-3 wrote:
>
> Hi,
>
> SanjeevGour wrote:
>> Hello,
>> I am generating a PDF using FOP. I have table which contains large text
>> in
>> cells. This text goes into the next column messing up the data. Following
>> is
>> my xsl -
>> <fo:table-cell padding="2pt" border="0.2pt solid black" width="auto">
>> <fo:block-container width="60px" height="10px"
>> overflow="scroll">
>> <fo:block>
>> tttttttttttttttttttttttttttttttttnnntttnttttttttttttttttt
>> </fo:block>
>> </fo:block-container>
>> </fo:table-cell>
>>
>> This text wrap correctly when it has spaces in between. That to happens
>> without using fo:block-container. I want when the text is large, it
>> should
>> continue with the next line. I don't know what value to specify and which
>> attributes need to be set for fo:block-container in order to do this.
>
> I don’t think there is any FO property to do that. You will have to
> insert zero width spaces (U+200B) between each letter of your long word.
> That will give FOP opportunities to break if the text doesn’t fit on
> a single line.
>
> HTH,
> Vincent
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/How-to-wrap-text-in-fo%3Atable-cell-tp18376733p18379768.html
Sent from the FOP - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: How to wrap text in fo:table-cell
Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi,
SanjeevGour wrote:
> Hello,
> I am generating a PDF using FOP. I have table which contains large text in
> cells. This text goes into the next column messing up the data. Following is
> my xsl -
> <fo:table-cell padding="2pt" border="0.2pt solid black" width="auto">
> <fo:block-container width="60px" height="10px"
> overflow="scroll">
> <fo:block>
> tttttttttttttttttttttttttttttttttnnntttnttttttttttttttttt
> </fo:block>
> </fo:block-container>
> </fo:table-cell>
>
> This text wrap correctly when it has spaces in between. That to happens
> without using fo:block-container. I want when the text is large, it should
> continue with the next line. I don't know what value to specify and which
> attributes need to be set for fo:block-container in order to do this.
I don’t think there is any FO property to do that. You will have to
insert zero width spaces (U+200B) between each letter of your long word.
That will give FOP opportunities to break if the text doesn’t fit on
a single line.
HTH,
Vincent
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org