2012-05-15 65 views

回答

2

閱讀關於dynamic content in reports的開發人員文檔。您可以使用repeatIn()函數遍歷日期,但訣竅是調整列寬。我懷疑你可以使用setTag()函數來更改表格的colWidths屬性。

Here's an example我用它來改變表格樣式。

<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'] &lt;= 5 else 5)}) ]] 
     <tr> 
      <td lineAboveColor="#000000" lineAboveThickness="5" lineAboveCount="1" lineAboveSpace="5"> 
      <para style="P10"><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 style="P17"><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 style="P18"><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>