11

In my case i have to provide spaces between two table rows upto .5cm.how can i achieve it.

code::

I have used:

<fo:table-row space-before="0.5cm" keep-together.within-column="always">                                                            

but it doesn't work,but the same attribute i have used in table

<fo:table  space-before="0.5cm" border="solid 0.1mm black">

here it works(in case of providibg space between two table) please let me know the solution

kjhughes
  • 106,133
  • 27
  • 181
  • 240
Avyaan
  • 1,285
  • 6
  • 20
  • 47

2 Answers2

18

Kevin's solution works by adding some space between cell border and it's inner content. In some cases, this might be sufficient. But correct solution (and only one if you have table with visible borders) is IMHO to use border-separation\border-spacing attribute instead:

<fo:table border-collapse="separate" border-separation="3pt">...</fo:table> This will add 3pt space between adjecent cells borders in row and column direction.

There is also CSS "shorthand" property border-spacing:

<fo:table border-collapse="separate" border-spacing="5pt 2pt">...</fo:table> This will add 5pt space between columns and 2pt space between rows.

Edit: Rephrased argument about Kevin's anwer correctness. Added links to spec. Added border-spacing alternative and example how to specify different spaces for rows\columns.

Michal Levý
  • 33,064
  • 4
  • 68
  • 86
  • What if I want this only for one row? – honzajde Jul 23 '14 at 15:43
  • 1
    @user271996 I dont think it's possible using this technique (same as with HTML tables). If you dont have visible borders, you can add one or more empty rows. In other cases, split table into two tables instead... – Michal Levý Jul 26 '14 at 11:45
  • @bajrangi this answer should be mark as the response to your question (use the green mark). – Moebius Sep 11 '14 at 10:40
3

Use padding on the blocks inside the table cells.

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38
  • Wrong. Doesn;t work is incorrect, a different result than what you have posted as a solution is certainly true. that is, if you have borders on the table cells and assuming the OP wanted them, but not on the table which is the only place the OP put a border. A border on the table is merely drawn around the table. I made no assumptions about what the OP wanted in terms of borders on cells. – Kevin Brown Dec 28 '13 at 22:25