You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Roger Tribe <ro...@pacsoluk.com> on 2002/04/17 11:12:23 UTC

Indenting Tables

Hi,

I am fairly new to FOP and XSLFO so forgive me if I sound a bit vague...

The product I am writing produces letters with the layout and content
produced on the fly.
The letters will have numerous tables included, but the left starting
positions of each table will vary.

I am trying to indent individual tables from the page margin without
success.
I have tried using margin-left, start-indent and position-absolute on the
table node and although the text position within the cell moves, the start
of the first cell in the table always appears at the page margin.

Being a newbie I am not sure if the problem lies with my FO knowledge or it
is the capabilities of FOP.

I would very much appreciate a FO snippet.

thanks

R. Tribe

Re: Indenting Tables

Posted by Jeremias Maerki <je...@outline.ch>.
I just found out something weird. I executed the following tests from
the NIST test suite:

http://www.zvon.org/HowTo/Output/xslfoTests_misc-hformatting1.php?at=margin-left
http://www.zvon.org/HowTo/Output/xslfoTests_cbpbp-padding2.php?at=padding-left

(you need to change master-name -> master-reference)

The second example doesn't look like the it should. But the first does.
When I then added margin-left="0in" to the second example, the padding
was correct. There seems to be a bug, obviously. I hope to have the
opportunity to look closer at it during the next few days.

Cheers,
Jeremias Märki

mailto:jeremias.maerki@outline.ch

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Indenting Tables

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Peter B. West wrote:
> Joerg,
> 
> I didn't check the context of this discussion, but in the content 
> definitions, "%block;" includes table-and-caption, table and list-block 
> (6.2 Formatting Object Content), even though these do not appear in 6.5 
> Block-level Formatting Objects.

Thank you for the correction.
Nevertheless, I'm still not sure whether FOP is correct
to not line up the texts in the following code:
    <fo:block margin-left="3cm">
     <fo:block>Stuff</fo:block>
      <fo:table margin-left="0pt" table-layout="fixed">
        <fo:table-column column-width="3cm"/>
        <fo:table-body>
          <fo:table-row>
            <fo:table-cell>
              <fo:block>Stuff</fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:block>
This is counterintuitive, in particular because the
equivalent HTML code
   <div style="margin-left: 3cm">
     <p>Stuff</p>
     <table>
       <tr><td>Stuff</td></tr>
     </table>
   </div>
will line up the texts. I know there are a few differences
between HTML/CSS and XSLFO regarding tables. The spec is no
real help in this case, everything i read in the tables
section can be interpreted that either way is correct.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Indenting Tables

Posted by "Peter B. West" <pb...@powerup.com.au>.
Joerg,

I didn't check the context of this discussion, but in the content 
definitions, "%block;" includes table-and-caption, table and list-block 
(6.2 Formatting Object Content), even though these do not appear in 6.5 
Block-level Formatting Objects.

Peter

J.Pietschmann wrote:

> Tables are not block level
> elements for some strange reason.




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Indenting Tables

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Roger Tribe wrote:
> I am trying to indent individual tables from the page margin without 
> success.

This appears to be intentional, though inconvenient. I read
the spec about a dozen times, or so, and the behaviour
appears to be conformant. Tables are not block level
elements for some strange reason.

I usually create an invisible column serving as margin:
   <fo:table table-layout="fixed">
     <fo:table-column column-width="2cm"/>
     <fo:table-column  border-color="black" border-style="solid"
       border-width=".5mm" column-width="3cm"/>
     <fo:table-body>
       <fo:table-row>
         <fo:table-cell/>
         <fo:table-cell>
           <fo:block>stuff</fo:block>
         </fo:table-cell>
       </fo:table-row>
     </fo:table-body>
   </fo:table>

If you use XSLT to generate the file, it should
not be too hard to keep block margins and the table
column width consistent.

> I have tried using margin-left, start-indent and position-absolute on 
> the table node and although the text position within the cell moves,
Thats because table cell areas are reference areas.
You have to reset most block properties on the table
element if you don't want to have them inherited.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Indenting Tables

Posted by Jeremias Maerki <je...@outline.ch>.
You're right, it doesn't. It's probably a bug, I'm not sure. So, try the
following: Create a blind table with 2 columns. The first column should
be exactly the same width you expect your table to be indented. Then
include your table in a table-cell in the second column of the blind
table.

Can somebody please confirm if the following is a bug?

Problem: In the following example FOP currently does not indent the
child block.

<fo:block padding-left="2cm">
	<fo:block>Some text</fo:block>
</fo:block>

> but this does not seem to work.
> The text in the table cell pads, but the first table row still starts at the
> page margin.

Cheers,
Jeremias Märki

mailto:jeremias.maerki@outline.ch

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Indenting Tables

Posted by Jeremias Maerki <je...@outline.ch>.
Have you tried using padding-left on a block?

Ok, a snippet:
<fo:block padding-left="2cm">
	<fo:table.....
</fo:block>

You can find a lot of sample files in the FOP distribution under
docs/examples/fo. I hope this helps.

> I am fairly new to FOP and XSLFO so forgive me if I sound a bit vague...
> 
> The product I am writing produces letters with the layout and content
> produced on the fly.
> The letters will have numerous tables included, but the left starting
> positions of each table will vary.
> 
> I am trying to indent individual tables from the page margin without
> success.
> I have tried using margin-left, start-indent and position-absolute on the
> table node and although the text position within the cell moves, the start
> of the first cell in the table always appears at the page margin.
> 
> Being a newbie I am not sure if the problem lies with my FO knowledge or it
> is the capabilities of FOP.
> 
> I would very much appreciate a FO snippet.

Cheers,
Jeremias Märki

mailto:jeremias.maerki@outline.ch

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Tel. +41 41 317 2020 - Fax +41 41 317 2029
Internet http://www.outline.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org