2012-04-24 67 views
3

有沒有什麼方法可以在openerp6.0中的rml模板中打包單詞。我已經定義了一個列寬,以便在openerp.But的銷售訂單模板中獲取產品名稱。被添加它只是跨越rml模板報告中的列。任何人都可以爲這個問題獲得解決方案。Word打包在Openerp中的.rml報告

回答

3

我認爲這不支持開箱即用。我建議你爲想要顯示的對象添加一些方法,這些方法將提供包裝到給定列長度的值(仔細一點,如果使用比例字體,固定寬度對此更好)。

Python標準庫的textwrap模塊可能用於編寫這些方法。

+0

是否有任何函數在rml本身換行? – 2012-04-25 06:59:39

+0

我只想用例如:600個字符來包裝一個長的單詞而沒有任何空間到一個單獨的列。我找到了一個break_long_words函數用於python我該如何在我的rml報告中實現它? – 2012-05-11 11:23:28

2

只需將該單元格的內容包含在段落標記中即可。這裏有一個例子:

<!DOCTYPE document SYSTEM "rml.dtd" > 
<document filename="wraps.pdf"> 
    <template showBoundary="0"> 
    <pageTemplate id="main"> 
     <pageGraphics /> 
     <frame id="first" x1="150" y1="400" width="250" height="400" /> 
    </pageTemplate> 
    </template> 
    <stylesheet> 
    <blockTableStyle id="blocktablestyle4"> 
     <!-- show a grid: this also comes in handy for debugging your tables.--> 
     <lineStyle kind="GRID" colorName="green" thickness="1" start="0,0" stop="-1,-1" /> 
    </blockTableStyle> 
    <paraStyle name="textstyle1" fontName="Helvetica" fontSize="9" textColor="blue" /> 
    </stylesheet> 
    <story> 
    <blockTable style="blocktablestyle4" colWidths="2cm,2cm"> 
     <tr> 
     <td>cell A</td> 
     <td>This doesn't wraps.</td> 
     </tr> 
     <tr> 
     <td>cell C</td> 
     <td> 
      <para style="textstyle1">to see how it works. This is yet more long text to demonstrate wrapping through "para" tag.</para> 
     </td> 
     </tr> 
    </blockTable> 
    </story> 
</document> 
+0

這與一個productWithAVeryVeryVeryLongNameAndNoSpacesInsideWhichIs通常不分裂AsTheOriginalPosterQueriedAbout? – 2012-04-26 07:12:43

+0

對不起。我忘了「沒有空間的長名字」部分。無論如何,這個函數出現後需要這個,以便包裝結果字符串。 – yucer 2012-05-21 04:03:01

0

我建議你使用parawrap標籤作爲這樣的:當你顯示一個對象的名稱

<parawrap>[[o.name]]</parawrap> 

這個例子是使用。

+0

該標籤給出錯誤。 except_orm:(u'list索引超出rangeparagraph文本的U」 <parawrap> LSA516.1.220.60.BR.s </parawrap > [[(line.product_id.default_code和(line.product_id.default_code [0] =='1'或line.product_id.default_code [0] =='2'))和line.product_id.name或line.product_id.default_code]]「引發異常」,(,IndexError('list index out of rangeparagraph text「caused exception',),)) – StackUP 2015-04-02 20:38:45