如何在表格中居中放置条形码图像?

问题描述 投票:0回答:1

我正在尝试在odoo中设计条形码标签,如果条形码较短,则会打印良好,否则条形码会越过表格边框,并且我无法用阅读器读取它,有时如果名称在第一位,它也会以2个标签打印细胞很长所以我需要为表格设置固定大小这是标签的2个屏幕截图damaged label

good label but barcode need to be in center

这里是代码

 <div class="col-xs-4" style="padding:0;" align="center">
                    <table class="table table-bordered mb-0" width="50mm" style="padding:0"  >
                      <tr  style="font-size: 50%;;padding:0" align="center" valign="center">
 <td style="font-size: 110%;;padding:0">
                            <strong t-field="product.name"/>
</td>
                      </tr>
                      <tr style="margin:0 auto;padding:0 auto;" align="center">
                        <td style="padding:1" align="center" colspan = "2">
                            <img t-if="product.barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', product.barcode,600 ,150)" style="width:120%;height:30%;margin:0 auto;padding:0 auto;"/>
                            <br style="text-align: center;padding:1;">     
                                <span  style="font-size: 6px;text-align: center;" t-field="product.barcode"/>
                            </br>
                        </td>
                      </tr>
                      <tr style="text-align: center;">
                        <td style="font-size: 50%;padding:0">www.autopartsegypt.com</td>
                      </tr>
                    </table>
             </div>
html css xml frontend odoo
1个回答
0
投票

尝试在img或td标签上使用margin-right:1%;,并根据需要增加百分比。

© www.soinside.com 2019 - 2024. All rights reserved.