Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
423 views
in Technique[技术] by (71.8m points)

xsl fo - Table with columns of different sizes in two rows

I was planning to use FOP to create a table structure like this:

|_Column1____2cm_|_Column2_2cm_|_Column3___3cm___|

|_Column4_2ndRow____3cm__|_Column5_2ndRow___4cm__|

As you may or may not see (depending on how this is displayed), I'm trying to have two rows of columns with different widths: the first column in the first row is bigger than the column directly under it in the second row, so this is not a traditional table design but some kind of an "asymmetric" table.

I would like to ask you if this is achievable with FOP at all, and if so, if you have any tips on how to do it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It is achievable with FOP.

If you know HTML <table>, then FOP tables work very much the same.

In your case you create a 4 column, 2 row table, then use colspan to "merge" some of the cells.

┌───────┬───────┬───────┬───────┐
│       │  colspan="2"  │       │
├───────┼───────┼───────┼───────┤
│  colspan="2"  │  colspan="2"  │
└───────┴───────┴───────┴───────┘

In HTML, that would be:

<table border="1" style="border-collapse: collapse">
  <tr>
    <td style="width: 2cm">X</td>
    <td style="width: 2cm" colspan="2">X</td>
    <td style="width: 3cm">X</td>
  </tr>
  <tr>
    <td style="width: 3cm" colspan="2">X</td>
    <td style="width: 4cm" colspan="2">X</td>
  </tr>
</table>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...