Question

I need my table to be like this: let say it has two rows. First row has six columns and second row has two columns (but whole rows lengths are the same of course). I need this because I need to put description of a product below and it needs more space than the rest of the columns So graphically it would look like this:

1col|2col|3col|4col|5col|6col|
1col     |2col                |

Report Markup Language is being used, to write this table.

Now this table looks like this:

<para style="terp_default_1">[[repeatIn(o.order_line,'line')]]</para>
      <blockTable colWidths="180.0,70.0,80.0,70.0,50.0,85.0" style="Table5">
        <tr>
          <td>
            <para style="terp_default_9">[[ line.name ]] </para>
          </td>
          <td>
            <para style="terp_default_Centre_9">[[ ', '.join(map(lambda x: x.name, line.tax_id)) ]]</para>
          </td>
          <td>
            <para style="terp_default_Right_9">[[ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]]$
          </td>
          <td>
            <para style="terp_default_Right_9">[[ formatLang(line.price_unit) ]]</para>
          </td>
          <td>
            <para style="terp_default_Centre_9">[[ formatLang(line.discount, digits=get_digits(dp='Sale Price')) ]]</para>
          </td>
          <td>
            <para style="terp_default_Right_9">[[ formatLang(line.price_subtotal, digits=get_digits(dp='Sale Price')) ]] [[ o.pricelist_id.currency_id.symbol ]]</para>
          </td>
        </tr>
        <tr>
          <td>
            <para style="terp_default_9">[[ line.product_id.product_tmpl_id.description ]]</para>
          </td>
        </tr>
</blockTable>

I suppose there should be a way to define specific rows (tr tags) to have specific number of columns. As it is now, columns length and number are defined in 'blockTable' tag. Or the best way would be to combine 1 and 2 into one column 3,4,5 and 6 column into second.

Update: I added html tag, because maybe it is similar approach as in rml.

Was it helpful?

Solution

I managed to solve this problem using this as an example: reportlab: setting colspan for td in rml

I needed to specify in:

<blockTableStyle><blockSpan start="1,1" stop="4,1"/></blockTableStyle>

Which means that second row begining from second column to the last one will be combined into one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top