Read through the developer documentation on dynamic content in reports. You can use the repeatIn() function to loop over your dates, but the trick will be adjusting column widths. I suspect you can change the colWidths attribute of the table using the setTag() function.
Here's an example where I used it to change the table style.
@ <section>
@ [[ repeatIn(lines(data['form'],object=o), 'a') ]]
@ <blockTable>
@ [[ setTag('blockTable','blockTable',{'colWidths': '80.0,150.0,80.0', 'style': 'Table' + str(a['level'] if a['level'] <= 5 else 5)}) ]]
@ <tr>
@ <td lineAboveColor="#000000" lineAboveThickness="5" lineAboveCount="1" lineAboveSpace="5">
@ <para ><font>[[ setTag('font','font',{'face':o.font_style or 'Helvetica', 'color':o.color_font.name or 'black', 'backColor':o.color_back.name or 'white'}) ]] [[ a['code'] ]]</font></para>
@ </td>
@ <td>
@ <para ><font color="white">[[ '..'*(a['level']-1) ]]</font><font>[[ setTag('font','font',{'face':o.font_style or 'Helvetica', 'color':o.color_font.name or 'black', 'backColor':o.color_back.name or 'white'}) ]] [[ a['name'] ]]</font></para>
@ </td>
@ <td>
@ <para ><font>[[ setTag('font','font',{'face':o.font_style or 'Helvetica', 'color':o.color_font.name or 'black', 'backColor':o.color_back.name or 'white'}) ]][[ '%.2f'% a['balance'] ]]</font></para>
@ </td>
@ </tr>
@ </blockTable>
@ </section>
控制表格中的字體的顯示顏色:
測試OK的例子.
e.g:
@<td>
@ <para >
@ <font>
@ [[((k['zmjb_gs'] and k['zmjb_gs']-(k['tiao_gs'] and k['tiao_gs'] or 0) or 0)>40)
@ and setTag('font','font',{'face':'Helvetica', 'color':'red', 'backColor':'white'}) ]]
@ [[((k['zmjb_gs'] and k['zmjb_gs']-(k['tiao_gs'] and k['tiao_gs'] or 0) or 0)>40)
@ and '?' or '']]
@ [[k['zmjb_gs'] ]]
@ </font>
@ </para>
@</td>
本文轉自:http://stackoverflow.com/questions/10596836/dynamic-generation-of-report-using-rml-in-openerp
*