ZPL How to center text with variable length

 ̄綄美尐妖づ 提交于 2019-12-11 07:08:36

问题


I use Zebra Designer to create my labels. But I have a problem to center my elements.

Indeed when I create a text box with Zebra Designer, it has a fixed length and when I replace the text inside (by a variable Php giving me the price for example) ==> if this text is larger than this that I have defined it does not focus.

So I would like to create a text box the width of the label and where the text would be centered inside, regardless of its length

CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR5,5~SD15^JUS^LRN^CI0^XZ
^XA
^FT256,576^XG014.GRF,1,1^FS
^FT256,576^XG015.GRF,1,1^FS
^BY3,3,52^FT127,484^BCB,,Y,N
^FD>:$customer_key^FS
^FT56,429^A0B,28,28^FH\^FDTEXT_TO_REPLACE^FS
^FT197,401^A0B,28,28^FH\^FDTEXT_TO_REPLACE^FS
^BY3,3,57^FT781,434^BCB,,Y,N
^FO256,23^GB0,559,1^FS
^PQ1,0,1,Y^XZ
^XA^ID000.GRF^FS^XZ
^XA^ID015.GRF^FS^XZ

回答1:


Use the Field Block ^FB Command; Parameter D is the justification, here set to C for center

^FT250,600^A0B,28,28^FB600,1,0,C^FH\^FDTEXT_TO_REPLACE^FS


来源:https://stackoverflow.com/questions/50483206/zpl-how-to-center-text-with-variable-length

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!