3

openerp6.0 の rml テンプレートで単語をラップする方法はありますか。openerp の販売注文テンプレートで製品名を取得するために列幅を定義しました。しかし、スペースのない長い名前を追加すると、rml テンプレートの列を横切るだけです。一人で報告してください。誰でもこの問題の解決策を提案できますか。

4

3 に答える 3

3

これはそのままではサポートされていないと思います。表示するオブジェクトに、特定の列の長さに折り返された値を提供するいくつかのメソッドを追加することをお勧めします (注意してください。プロポーショナル フォントを使用する場合、これは非常にトリッキーになります。これには固定幅を使用することをお勧めします)。

これらのメソッドを記述するには、Python 標準ライブラリのtextwrapモジュールが役立つ場合があります。

于 2012-04-24T07:07:52.470 に答える
2

セルの内容をparaタグで囲むだけです。次に例を示します。

<!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>
于 2012-04-25T16:30:40.220 に答える