悬挂缩进会影响左缩进吗?

indent.docx (21.8 KB)

为什么第一个段落和第三个段落左缩进磅数不为0?

@Crane

请您提供更多信息,例如您使用的代码或具体的操作步骤,以便我们更好地理解您的问题。

@Crane 这是因为该段有以下设置:

是因为Hanging悬挂缩进会影响左缩进的值是吗,我在word中尝试对悬挂缩进的段落设置左缩进(单位为磅)不能成功,但是单位为字符可以

@Crane 是的,创建悬挂缩进的左缩进正值和首行缩进负值会影响左缩进值。 下面的简单代码可以说明为什么会出现这种情况:

Document doc = new Document("input.docx");

Paragraph paragraph = doc.getFirstSection().getBody().getFirstParagraph();
paragraph.getParagraphFormat().setFirstLineIndent(-ConvertUtil.millimeterToPoint(6));
paragraph.getParagraphFormat().setLeftIndent(ConvertUtil.millimeterToPoint(6));

doc.save("output.docx");

Word 通常使用点(1/72 英寸)来测量缩进量,您可以将磅(1/72 英寸)转换为点,因为在这种情况下它们是等价的。