程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Python >> 關於rml報表tb樣式顏色控制

關於rml報表tb樣式顏色控制

編輯:Python

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'] &lt;= 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

*
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved