【发布时间】:2022-01-06 18:01:19
【问题描述】:
我有一个使用 Apache POI 创建 power point 演示文稿的应用程序。我有一些文本框,我需要将这些文本框的左右边距设置为 0。 假设它只是这两行:
xslfTextParagraph.setLeftMargin(0.0d);
xslfTextParagraph.setRightMargin(0.0d);
但是这似乎对我不起作用。
相关代码sn-p:
TextBox<XSLFShape, XSLFTextParagraph> textShape = shapeGroup.createTextBox();
Rectangle rect = new Rectangle(x, y, width, height);
textShape.setAnchor(rect.getBounds2D());
XSLFTextParagraph xslfTextParagraph = textShape.getTextParagraphs().get(0);
xslfTextParagraph.setLeftMargin(0.0); // <- This does not change the margin of the textbox
xslfTextParagraph.setRightMargin(0.0); // <- This does not change the margin of the textbox
XSLFTextRun r = xslfTextParagraph.addNewTextRun();
r.setText("Some text");
r.setFontColor(new Color(0,0,0));
r.setFontSize(14.0);
r.setBold(true);
Java 版本:1.8, Apache POI 版本:5.0.0
您有什么建议我如何将边距设置为零?
【问题讨论】:
标签: java apache-poi powerpoint