pdfptable的无形边框 [英] An invisible border of pdfptable

查看:3360
本文介绍了pdfptable的无形边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iText库在Java中生成pdf文件。我在pdfptable中写数据,如何使表的边框不可见?

I am using iText library for generating pdf files in Java. I am writing data in pdfptable , how can I make the borders of table invisible?

推荐答案

定义PdfPTable的边框元素通过PdfPCell添加到表中。每个Cell都有自己的样式/格式。
以下是API: http://api.itextpdf.com/

The Border Elements of the PdfPTable are defined by the PdfPCell which are added to the table. Each Cell will have its own style/formatting. Here is the API: http://api.itextpdf.com/

示例

PdfPTable table = new PdfPTable(2);
PdfPCell cellOne = new PdfPCell(new Phrase("Hello"));
PdfPCell cellTwo = new PdfPCell(new Phrase("World"));

cellOne.setBorder(Rectangle.NO_BORDER);
cellOne.setBackgroundColor(new Color(255,255,45));

cellTwo.setBorder(Rectangle.BOX);

table.addCell(cellOne);
table.addCell(cellTwo);

如果您想了解有关矩形/边界值的更多详细信息,请查看IText常量值部分对于矩形,请访问: http://api.itextpdf.com/constant-values.html

If you want more detail about the Rectangle/Border values, take a look at the IText Constant values section for Rectangle, here : http://api.itextpdf.com/constant-values.html

这篇关于pdfptable的无形边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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