iText-5.0.1 +用虚线表示PdfPTable的边框 [英] iText-5.0.1 + Make the border of PdfPTable with dotted line

查看:1464
本文介绍了iText-5.0.1 +用虚线表示PdfPTable的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在iText-5.0.1中用虚线(例如_ _ _ _ _ _ _ _ _ _ _ _)代替实线(例如________________)制作单元格的边框?

Is there any way to make the border of a cell with dotted line (e.g _ _ _ _ _ _ _ _ _ _ _ _) instead of solid line ( e.g ________________ ) in iText-5.0.1????

推荐答案

用破折号加下划线的单元格:

Cell underlined with dashes:

public class UnderlinedCell implements PdfPCellEvent {

    public void cellLayout(PdfPCell cell, Rectangle position,
        PdfContentByte[] canvases) {
        PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
        canvas.setLineWidth(0.5f);
        canvas.setLineDash(3f, 3f);
        canvas.moveTo(position.getLeft(), position.getBottom());
        canvas.lineTo(position.getRight(), position.getBottom());

        canvas.stroke();
    }
}

这篇关于iText-5.0.1 +用虚线表示PdfPTable的边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆