ZPL: How to horizontally centered a line of text on a label regardless of text length

Viewed 7586

I need to center some text horizontally on a label so that if the length of text changes it will still remain centered.

I am using XSLT to process the format like this:

        <!-- Position from Home (3.75",4.00")-->
        <xsl:text><![CDATA[^FT494,812]]></xsl:text>

        <xsl:text><![CDATA[^A0B,62,62]]></xsl:text>

      <!-- I am using the FB command to center the text -->
       <xsl:text><![CDATA[^FB500,1,0,C]]></xsl:text>

        <!-- Field Block -->
        <xsl:text><![CDATA[^FD]]></xsl:text>
        <xsl:value-of select="/lb:label/lb:MyDataField" />
        <xsl:text><![CDATA[^FS]]></xsl:text>

So that the output looks like this:

Example A:

        123 Good Street
1234567890 1234567890 1234567890

or

Example: B

 123 Good Street
   1234567890

So far the text is not centering and the result looks like this:

        123 Good Street
        1234567890 1234567890 1234567890
1 Answers
Related