How to change the alignment of table in RML file?

2019-09-18 06:54发布

问题:

I am working with OpenOffice designer to edit OpenERP reports, I set the alignment of table to left or right and I save and send to server. When I print the invoice report, the table is always in the center. So I am going to edit it from RML file but I don't know how to do this Please help me.

回答1:

Simply add alignment="RIGHT" attribute to the element you want to align

For example:

<paraStyle name="addressBox"
           fontName="Arial"
           fontSize="12"
           alignment="RIGHT"
/>

If you need further details, check the RML User Guide



回答2:

blockTable

A typical block table.

Attributes

  • style - Style

    Style: The table style that is applied to the table.

  • rowHeights - Sequence of Measurement

    Row Heights: A list of row heights in the table.

  • colWidths - Sequence of Measurement

    Column Widths: A list of column widths in the table.

  • repeatRows - Integer

    Repeat Rows: A flag to repeat rows upon table splits.

  • alignment - Choice of ('left', 'decimal', 'right', 'center', 'centre')

    Alignment: The alignment of whole table.

Example:

    <blockTable  alignment="RIGHT"> 
     <tr>
      <td>whole table align right</td>

     </tr>
     </blockTable>


回答3:

I used this in my code:

<stylesheet>
...
 <blockTableStyle id="Table_style1">
      <blockAlignment value="LEFT"/> <!-- "RIGHT" "CENTER" -->
</blockTableStyle>
...
</stylesheet>

<story>
    <blockTable  style="Table_style1"> 
        <tr>
            <td>
            </td>
     </tr>
    </blockTable>
</story>


回答4:

<paraStyle name="nospace" fontName="Courier" fontSize="10" spaceBefore="0" spaceAfter="0"/>
            <paraStyle name="logo" fontName="Courier" fontSize="10" spaceBefore="0" spaceAfter="0" valign="bottom"/>
            <paraStyle name="variant" fontName="Courier" fontSize="30" spaceBefore="0" spaceAfter="0" valign="top"  alignment="Center"/>
            <paraStyle name="details" fontName="Courier" fontSize="10" spaceBefore="0" spaceAfter="0"/>

Add above style,After this

 <blockTable style="mytable" colWidths="3.0cm,6.3cm" rowHeights="2.0cm,0cm">
         <tr>
            <td ><para style="variant">A</para></td>
            <td>
                <para style="details">Product : <xsl:value-of select="product" />
                        Project : <xsl:value-of select="prj" />
                        Manuf. Order :  <xsl:value-of select="mrp" />
                        Work Center :  </para>
            </td>
        </tr>
         <tr>
           <td> </td>
            <td>
            </td>
        </tr>
    </blockTable>