1

I'm trying to make a pdf in Clojure with a one-to-many structure. Something like:

+------+----+------+-------+------+
| Name | ID | Make | Model | Year |
+------+----+------+-------+------+
| Bob    23 | Volvo   240    1980 |
|           | Saab     99    1985 |
+-----------+---------------------+
| Foo    32 | Opel    XXX    1972 |

And so on. The way I've tried is to do like this

(pdf/pdf [
    {:orientation :landscape}
    [:table {:header ["Name" "ID" "Make" "Model" "Year"]}
        [[:table {:colspan 2} ["Bob" "23"]]
         [:table {:colspan 3} ["Volvo" "240" "1980"]
                              ["Saab" "99" "1985"]]]
        [[:table {:colspan 2} ["F00" "32"]]
         [:table {:colspan 3} ["Opel" "XXX" "1972"]]]]
    ]
    "foo.pdf")

This is one of the versions that I've tried (and every permutation I could think of). Needless to say, it hasn't worked at all!

Does anyone have any ideas how to accomplish what I'm looking for?

Regards

Kingfranz
  • 184
  • 1
  • 12

1 Answers1

0

You need to use :cell

Cells can be optionally used inside tables to provide specific style for table elements, including :colspan.

This is untested :

[:table {:header ["Name" "ID" "Make" "Model" "Year"]} [[:cell {:colspan 2} [:table ["Bob" "23"]]] [:cell {:colspan 3} [:table ["Volvo" "240" "1980"] ["Saab" "99" "1985"]]]] [[:cell {:colspan 2} [:table ["F00" "32"]]] [:cell {:colspan 3} [:table ["Opel" "XXX" "1972"]]]]] ]

leontalbot
  • 2,513
  • 1
  • 23
  • 32