Reportlab: Setting Colspan For Td In Rml
I can't find any option, that would allow to set colspan for td element in rml. Is that somehow possible?
Solution 1:
Gordon's suggestion of the blockSpan
element worked for me. Here's an example of how to use it:
<?xml version="1.0"?><documentfilename="test.pdf"><templatepageSize="(612,792)"title="Test"author="Don Kirkby"><pageTemplateid="first"><frameid="first"x1="10.0"y1="10.0"width="592"height="772"/></pageTemplate></template><stylesheet><blockTableStyleid="main"><blockSpanstart="0,1"stop="1,1"/></blockTableStyle></stylesheet><images/><story><blockTablecolWidths="100.0,287.5,187.5"style="main"><tr><td><para>Cell 0,0</para></td><td><para>Cell 1,0</para></td><td><para>Cell 2,0</para></td></tr><tr><td><para>Cell 0,1 will flow into its neighbour</para></td><td><para>Cell 1,1 will not appear, but must be present</para></td><td><para>Cell 2,1</para></td></tr><tr><td><para>Cell 0,2</para></td><td><para>Cell 1,2</para></td><td><para>Cell 2,2</para></td></tr></blockTable></story></document>
Solution 2:
The normal ReportLab way to do this would be to instead use Platypus and the Table
flowable. When you set the style of the Table
, you can specify a 'SPAN'
command that will bundle any rectangular area of cells into one. You'll find more information on this in the ReportLab User Guide, chapter 7, page 81.
If you must use RML, I'm inclined to think that colspan is simply not available. It's at least not in the ReportLab RML reference document. Instead I think you are supposed to use blockSpan
elements. There's no example given, but you'll find it in the RML manual.
Post a Comment for "Reportlab: Setting Colspan For Td In Rml"