Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
457 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 Reply

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...