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 Brian Trezise <Br...@IntelliData.net> on 2008/08/12 22:07:11 UTC

Problem with table formatting

I'm having a problem formatting table cells where FOP wants to wrap lines
for every word in the cell, even though there is plenty of room for the
entire contents of the cell without line wrapping.

I'm building a fo:table as follows:

<fo-snippet>

<fo:block-container absolute-position='fixed'>
	<fo:block margin-top='340pt' margin-left='325pt' font-weight='bold'
font-size='12pt'>
		<xsl:value-of select='part/spec-data/caption'/>
	</fo:block>
</fo:block-container>

<fo:block-container absolute-position='fixed'>
	<fo:block margin-top='365pt' margin-left='160pt' text-align='left'>
		<fo:table>
			<fo:table-column column-width='150pt'/>
			<fo:table-column column-width='150pt'/>
			<fo:table-body>
				<xsl:for-each select="part/spec-data/row">
					<fo:table-row>
						<fo:table-cell>
							<fo:block
font-size='8pt' font-weight='bold'>
	
<xsl:value-of select='table-header'/>:
							</fo:block>
						</fo:table-cell>
						<fo:table-cell>
							<fo:block
font-size='8pt'>
	
<xsl:value-of select='table-data'/>
							</fo:block>
						</fo:table-cell>
					</fo:table-row>
				</xsl:for-each>
			</fo:table-body>
		</fo:table>
	</fo:block>
</fo:block-container>

</fo-snippet>

However, when I run fop on this table, I am getting the word wrapping (see
attachment for screenshot).  Can somebody tell me what I'm doing wrong here?

Thanks,
___________________________________________________
Brian Trezise
Staff Software Engineer
IntelliData, Inc
22288 E Princeton Dr
aurora, colorado 80018
T: 720.524.4864
brian.trezise@intellidata.net

RE: Problem with table formatting

Posted by Brian Trezise <Br...@IntelliData.net>.
That got it, thanks :)

___________________________________________________
Brian Trezise
Staff Software Engineer
IntelliData, Inc
22288 E Princeton Dr
aurora, colorado 80018
T: 720.524.4864
brian.trezise@intellidata.net


-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Tuesday, August 12, 2008 2:48 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Problem with table formatting

The problem here is property inheritance. You're specifying a
margin-left="160pt" on a block. That margin is internally mapped to
start-indent which is an inherited property. It will be propagated into
the fo:table-cell. And because fo:table-cell produces a so-called
reference-area, the space available for text is restricted by 160pt. In
your particular case you end up with a negative available width (150pt -
160pt = -10pt) inside the table-cell. That's why FOP breaks after every
word. I know this sounds weird but it's the way XSL-FO works.

The full details can be found here if you're interested:
http://wiki.apache.org/xmlgraphics-fop/IndentInheritance

Executive summary and work-around:
Just set start-indent="0pt" and end-indent="0pt" on the fo:table-body.

On 12.08.2008 22:07:11 Brian Trezise wrote:
> I'm having a problem formatting table cells where FOP wants to wrap lines
> for every word in the cell, even though there is plenty of room for the
> entire contents of the cell without line wrapping.
> 
> I'm building a fo:table as follows:
> 
> <fo-snippet>
> 
> <fo:block-container absolute-position='fixed'>
> 	<fo:block margin-top='340pt' margin-left='325pt' font-weight='bold'
> font-size='12pt'>
> 		<xsl:value-of select='part/spec-data/caption'/>
> 	</fo:block>
> </fo:block-container>
> 
> <fo:block-container absolute-position='fixed'>
> 	<fo:block margin-top='365pt' margin-left='160pt' text-align='left'>
> 		<fo:table>
> 			<fo:table-column column-width='150pt'/>
> 			<fo:table-column column-width='150pt'/>
> 			<fo:table-body>
> 				<xsl:for-each select="part/spec-data/row">
> 					<fo:table-row>
> 						<fo:table-cell>
> 							<fo:block
> font-size='8pt' font-weight='bold'>
> 	
> <xsl:value-of select='table-header'/>:
> 							</fo:block>
> 						</fo:table-cell>
> 						<fo:table-cell>
> 							<fo:block
> font-size='8pt'>
> 	
> <xsl:value-of select='table-data'/>
> 							</fo:block>
> 						</fo:table-cell>
> 					</fo:table-row>
> 				</xsl:for-each>
> 			</fo:table-body>
> 		</fo:table>
> 	</fo:block>
> </fo:block-container>
> 
> </fo-snippet>
> 
> However, when I run fop on this table, I am getting the word wrapping (see
> attachment for screenshot).  Can somebody tell me what I'm doing wrong
here?
> 
> Thanks,
> ___________________________________________________
> Brian Trezise
> Staff Software Engineer
> IntelliData, Inc
> 22288 E Princeton Dr
> aurora, colorado 80018
> T: 720.524.4864
> brian.trezise@intellidata.net




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Problem with table formatting

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
The problem here is property inheritance. You're specifying a
margin-left="160pt" on a block. That margin is internally mapped to
start-indent which is an inherited property. It will be propagated into
the fo:table-cell. And because fo:table-cell produces a so-called
reference-area, the space available for text is restricted by 160pt. In
your particular case you end up with a negative available width (150pt -
160pt = -10pt) inside the table-cell. That's why FOP breaks after every
word. I know this sounds weird but it's the way XSL-FO works.

The full details can be found here if you're interested:
http://wiki.apache.org/xmlgraphics-fop/IndentInheritance

Executive summary and work-around:
Just set start-indent="0pt" and end-indent="0pt" on the fo:table-body.

On 12.08.2008 22:07:11 Brian Trezise wrote:
> I'm having a problem formatting table cells where FOP wants to wrap lines
> for every word in the cell, even though there is plenty of room for the
> entire contents of the cell without line wrapping.
> 
> I'm building a fo:table as follows:
> 
> <fo-snippet>
> 
> <fo:block-container absolute-position='fixed'>
> 	<fo:block margin-top='340pt' margin-left='325pt' font-weight='bold'
> font-size='12pt'>
> 		<xsl:value-of select='part/spec-data/caption'/>
> 	</fo:block>
> </fo:block-container>
> 
> <fo:block-container absolute-position='fixed'>
> 	<fo:block margin-top='365pt' margin-left='160pt' text-align='left'>
> 		<fo:table>
> 			<fo:table-column column-width='150pt'/>
> 			<fo:table-column column-width='150pt'/>
> 			<fo:table-body>
> 				<xsl:for-each select="part/spec-data/row">
> 					<fo:table-row>
> 						<fo:table-cell>
> 							<fo:block
> font-size='8pt' font-weight='bold'>
> 	
> <xsl:value-of select='table-header'/>:
> 							</fo:block>
> 						</fo:table-cell>
> 						<fo:table-cell>
> 							<fo:block
> font-size='8pt'>
> 	
> <xsl:value-of select='table-data'/>
> 							</fo:block>
> 						</fo:table-cell>
> 					</fo:table-row>
> 				</xsl:for-each>
> 			</fo:table-body>
> 		</fo:table>
> 	</fo:block>
> </fo:block-container>
> 
> </fo-snippet>
> 
> However, when I run fop on this table, I am getting the word wrapping (see
> attachment for screenshot).  Can somebody tell me what I'm doing wrong here?
> 
> Thanks,
> ___________________________________________________
> Brian Trezise
> Staff Software Engineer
> IntelliData, Inc
> 22288 E Princeton Dr
> aurora, colorado 80018
> T: 720.524.4864
> brian.trezise@intellidata.net




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: Problem with table formatting

Posted by Brian Trezise <Br...@IntelliData.net>.
Ok, got it.  The table in question is at the bottom.

 

___________________________________________________
Brian Trezise
Staff Software Engineer
IntelliData, Inc
22288 E Princeton Dr
aurora, colorado 80018
T: 720.524.4864
brian.trezise@intellidata.net

 

From: David Gerdt [mailto:Dgerdt@bju.edu] 
Sent: Tuesday, August 12, 2008 2:29 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Problem with table formatting

 

This looks like a snippet from your XSL. Can you provide a sample of the
actual *FO* file produced when your transform is run? Without the associated
XML, we can't render the snippet you provide.

>>> "Brian Trezise" <Br...@IntelliData.net> 8/12/2008 4:07 PM >>>
I'm having a problem formatting table cells where FOP wants to wrap lines
for every word in the cell, even though there is plenty of room for the
entire contents of the cell without line wrapping.

I'm building a fo:table as follows:

<fo-snippet>

<fo:block-container absolute-position='fixed'>
<fo:block margin-top='340pt' margin-left='325pt' font-weight='bold'
font-size='12pt'>
<xsl:value-of select='part/spec-data/caption'/>
</fo:block>
</fo:block-container>

<fo:block-container absolute-position='fixed'>
<fo:block margin-top='365pt' margin-left='160pt' text-align='left'>
<fo:table>
<fo:table-column column-width='150pt'/>
<fo:table-column column-width='150pt'/>
<fo:table-body>
<xsl:for-each select="part/spec-data/row">
<fo:table-row>
<fo:table-cell>
<fo:block
font-size='8pt' font-weight='bold'>

<xsl:value-of select='table-header'/>:
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block
font-size='8pt'>

<xsl:value-of select='table-data'/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
</fo:block-container>

</fo-snippet>

However, when I run fop on this table, I am getting the word wrapping (see
attachment for screenshot).  Can somebody tell me what I'm doing wrong here?

Thanks,
___________________________________________________
Brian Trezise
Staff Software Engineer
IntelliData, Inc
22288 E Princeton Dr
aurora, colorado 80018
T: 720.524.4864
brian.trezise@intellidata.net


Re: Problem with table formatting

Posted by David Gerdt <Dg...@bju.edu>.
This looks like a snippet from your XSL. Can you provide a sample of the actual *FO* file produced when your transform is run? Without the associated XML, we can't render the snippet you provide.

>>> "Brian Trezise" <Br...@IntelliData.net> 8/12/2008 4:07 PM >>>
I'm having a problem formatting table cells where FOP wants to wrap lines
for every word in the cell, even though there is plenty of room for the
entire contents of the cell without line wrapping.

I'm building a fo:table as follows:

<fo-snippet>

<fo:block-container absolute-position='fixed'>
<fo:block margin-top='340pt' margin-left='325pt' font-weight='bold'
font-size='12pt'>
<xsl:value-of select='part/spec-data/caption'/>
</fo:block>
</fo:block-container>

<fo:block-container absolute-position='fixed'>
<fo:block margin-top='365pt' margin-left='160pt' text-align='left'>
<fo:table>
<fo:table-column column-width='150pt'/>
<fo:table-column column-width='150pt'/>
<fo:table-body>
<xsl:for-each select="part/spec-data/row">
<fo:table-row>
<fo:table-cell>
<fo:block
font-size='8pt' font-weight='bold'>

<xsl:value-of select='table-header'/>:
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block
font-size='8pt'>

<xsl:value-of select='table-data'/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
</fo:block-container>

</fo-snippet>

However, when I run fop on this table, I am getting the word wrapping (see
attachment for screenshot).  Can somebody tell me what I'm doing wrong here?

Thanks,
___________________________________________________
Brian Trezise
Staff Software Engineer
IntelliData, Inc
22288 E Princeton Dr
aurora, colorado 80018
T: 720.524.4864
brian.trezise@intellidata.net