首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DynamicReport条形码宽度问题

DynamicReport条形码宽度问题
EN

Stack Overflow用户
提问于 2015-02-07 17:41:08
回答 1查看 447关注 0票数 0

我正在使用DynamicReport 4.0和以下代码来打印标签。但我不能增加条码的宽度。有没有办法增加动态报表中条码的宽度?

代码语言:javascript
复制
    private ComponentBuilder<?, ?> getList(String title, String content){
        return DynamicReports.cmp.horizontalList(DynamicReports.cmp.text(title), DynamicReports.cmp.text(":"), DynamicReports.cmp.text(content));
    }

private void showLabel(){
    JasperReportBuilder report = DynamicReports.report();
        TextFieldBuilder<String> heading = DynamicReports.cmp.text("XYZ Company Ltd.");
        StyleBuilder headingstyle= DynamicReports.stl.style().setFontSize(16).setBold(true).setUnderline(true).setAlignment(HorizontalAlignment.CENTER, VerticalAlignment.TOP);
        heading.setStyle(headingstyle);

        report.setPageFormat(283, 425, PORTRAIT);
        report.setPageMargin(DynamicReports.margin().setLeft(14).setTop(14).setRight(14).setBottom(14));
        report.setTemplate(DynamicReports.template().setBarcodeWidth(400).setBarcodeHeight(40));

        //report.title(heading);
        VerticalListBuilder list = DynamicReports.cmp.verticalList();
        list.setGap(15);
        list.add(
                heading,
                getList("Client", "Anirban Chakraborty"),
                getList("Batch No.", "T7170B1000"),
                getList("Drawing No.", "51004A-777777-0111-B1000"),
                getList("Mark No.", "170B1000"),
                getList("Qty.", "1"),
                getList("Part Sr. NO.", "1/1"),
                getList("Rev.", "1.0"),
                getList("Wt.", "1.900"),
                DynamicReports.bcode.code128("T7170B1000").setStyle(DynamicReports.stl.style().setHorizontalAlignment(HorizontalAlignment.CENTER))
        );
        report.title(list);
        try{
            report.show(false);
        }catch(DRException e){
            e.printStackTrace();
        }
}
EN

回答 1

Stack Overflow用户

发布于 2015-02-07 18:36:08

找到解决方案后,我们必须使用setModuleWidth(Double)。对于上面的代码,它将是

代码语言:javascript
复制
DynamicReports.bcode.code128("T7170B1000").setModuleWidth(3d).setStyle(DynamicReports.stl.style().setHorizontalAlignment(HorizontalAlignment.CENTER))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28380619

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档