Is there any way to wrap words in rml template in openerp6.0.I have defined a column width to get the product's name in sales order template of openerp.But when long names without space is added it just cross the column in the rml template report alone.Can anyone sugest a solution for this problem.
Asked
Active
Viewed 2,521 times
3 Answers
3
I don't think this is supported out of the box. I suggest that you add some methods to the objects you want to display that will provide the values wrapped to a given column length (careful, this gets very tricky if you use a proportional font, better stick with fixed width for this).
The textwrap module of the Python standard library may be of use in writing these methods.

gurney alex
- 13,247
- 4
- 43
- 57
-
is there any function for word wrapping in rml itself? – Pravitha V Apr 25 '12 at 06:59
-
i just want to wrap a long word with eg:600 cahracters without any space to a single column.i hvae found a break_long_words function for python how can i implement it in my rml reports ? – Pravitha V May 11 '12 at 11:23
2
Just enclose the content of the cell in a para tag. Here is an example:
<!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>

yucer
- 4,431
- 3
- 34
- 42
-
this works with a productWithAVeryVeryVeryLongNameAndNoSpacesInsideWhichIsUsuallyNotSplitAsTheOriginalPosterQueriedAbout? – gurney alex Apr 26 '12 at 07:12
-
I'm Sorry. I forgot the "long names without space" part. Anyway this will be needed after such function appear, in order to wrap the result string. – yucer May 21 '12 at 04:03
0
I suggest you to use the parawrap tag as this:
<parawrap>[[o.name]]</parawrap>
This example is used when you display name of an object.

Blankoworld
- 9
- 2
-
This tag gives error. except_orm: (u'list index out of rangeparagraph text u"
<parawrap>LSA516.1.220.60.BR.s</parawrap> " caused exception', ([[ (line.product_id.default_code and (line.product_id.default_code[0] == \'1\' or line.product_id.default_code[0] == \'2\')) and line.product_id.name or line.product_id.default_code ]] , IndexError('list index out of rangeparagraph text " caused exception',), – StackUP Apr 02 '15 at 20:38))