This question has been flagged
5129 Views

I have a rml template to print product labels:

<xsl:template match="object" mode="story">
  <blockTable style="taula2" rowHeights="0.5cm,1.2cm" colWidths="4cm,2.2cm">
    <tr>
      <td colspan="2">
        <para style="nospace"><xsl:value-of select="object.name"/></para>
      </td>
    </tr>
    <tr>
      <td>
        <barCode x="1cm" y="1cm" height="1cm" code="EAN13">
          <xsl:value-of select="object.ean13"/>
        </barCode>
      </td>
      <td>
        <para style="nospace"><b><xsl:text>PVP:</xsl:text></b></para>
        <para style="pvp"><b><xsl:value-of select="object.pvp"/><xsl:text> €</xsl:text></b></para>
      </td>
    </tr>
  </blockTable>
  <para style="nospace"></para>
</xsl:template>

with those stylesheets:

<stylesheet>
  <paraStyle name="nospace" spaceBefore="0" spaceAfter="0" leading="8">
    <xsl:attribute name="fontName">
      <xsl:value-of select="font_type"/>
    </xsl:attribute>
    <xsl:attribute name="fontSize">
      <xsl:value-of select="font_size"/>
    </xsl:attribute>
  </paraStyle>
  <paraStyle name="pvp" spaceBefore="0" spaceAfter="0" fontSize="14" alignment="center">
    <xsl:attribute name="fontName">
      <xsl:value-of select="font_type"/>
    </xsl:attribute>
  </paraStyle>
  <!-- In this point will be included additional report style sheets -->
  <blockTableStyle id='taula2'>
    <blockAlignment value='CENTER' />
    <blockValign value='MIDDLE' />
    <lineStyle kind='LINEBEFORE' colorName='black' start='0,0' stop='0,1' thickness='1' />
    <lineStyle kind='LINEAFTER' colorName='black' start='0,1' stop='0,1' thickness='1' />
    <lineStyle kind='LINEAFTER' colorName='black' start='1,0' stop='1,1' thickness='1' />
    <lineStyle kind='LINEBELOW' colorName='black' start='0,0' stop='-1,-1' tickness='1' />
    <lineStyle kind='LINEABOVE' colorName='black' start='0,0' stop='-1,-1' tickness='1' />
    <blockBackground colorName="lightgrey" start="0,0" stop="1,0"/>
    <blockValign value='BOTTOM' start='0,0' stop='1,0' />
    <blockFont name="Times-Bold" size="14" start='1,0' stop='1,1' />
    <blockAlignment value="CENTER" start='1,0' stop='1,1' />
  </blockTableStyle>
</stylesheet>

but product name is printed outside table when it's too large. How can I get something like what overflow="hidden" does?

I think limiting by name size is not a solution, since the number of characters that fit depend on used font size

Avatar
Discard