2012-04-24 66 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