3

ユーザーが指定した値にページ余白を設定するために、apache poi CTPageMar クラスを使用しています。問題は、関数 setLeft、setRight、setTop、および setBottom で渡さなければならない値の単位を見つけられなかったことです。cm、ピクセル、インチを試しましたが、すべて間違っているようです。何か案が?

XWPFDocument wordDocument = new XWPFDocument(new FileInputStream(input));
CTSectPr sectPr = wordDocument.getDocument().getBody().addNewSectPr();
CTPageMar pageMar = sectPr.addNewPgMar();
pageMar.setLeft(BigInteger.valueOf(left));
pageMar.setTop(BigInteger.valueOf(top));
pageMar.setRight(BigInteger.valueOf(right));
pageMar.setBottom(BigInteger.valueOf(bottom));
wordDocument.write(new FileOutputStream(output));
4

1 に答える 1