Mateusz Lewandowski
Mateusz Lewandowski

Reputation: 1

How to Set Border thickness of Apache POI XWPFTable table?

I need to set my table that would like to look BOLD so how to set thickness border?

I know how to change borders borders.addNewBottom().setVal(STBorder.SINGLE);

But how to change border thickness?

EDIT: I've done it. Like this:

table3.getCTTbl().getTblPr().getTblBorders().getTop().setSz(BigInteger.valueOf(11));
                        table3.getCTTbl().getTblPr().getTblBorders().getLeft().setSz(BigInteger.valueOf(12));
                        table3.getCTTbl().getTblPr().getTblBorders().getRight().setSz(BigInteger.valueOf(12));
                        table3.getCTTbl().getTblPr().getTblBorders().getBottom().setSz(BigInteger.valueOf(12));
                        table3.getCTTbl().getTblPr().getTblBorders().getInsideH().setSz(BigInteger.valueOf(12));
                        table3.getCTTbl().getTblPr().getTblBorders().getInsideV().setSz(BigInteger.valueOf(12));

BTW where the hell am I supposed to know what it means by setSz?

Upvotes: 0

Views: 1726

Answers (1)

jmarkmurphy
jmarkmurphy

Reputation: 11473

You could try

borders.addNewBottom().setVal(STBorder.THICK);

The STBorder class contains both line borders and art borders. Everything down to inset is a line border, and can be used wherever borders can be used. Everything from apple on down is an art border and can only be used for page borders.

Upvotes: 1

Related Questions