我想更改某些 PowerPoint 对象中的文本缩进。
段落 -> 缩进 -> 文本之前
段落 -> 缩进 -> 特殊 -> 悬挂(如何在 FirstLine 或无上更改它?) -> 通过
从我在以前的版本中发现的可以用
段落.ParagraphFormat.FirstLineIndent = x;
段落.ParagraphFormat.LeftIndent = x;
但现在没有这样的属性可用。
我想更改某些 PowerPoint 对象中的文本缩进。
段落 -> 缩进 -> 文本之前
段落 -> 缩进 -> 特殊 -> 悬挂(如何在 FirstLine 或无上更改它?) -> 通过
从我在以前的版本中发现的可以用
段落.ParagraphFormat.FirstLineIndent = x;
段落.ParagraphFormat.LeftIndent = x;
但现在没有这样的属性可用。
好吧,我想通了。这是诀窍:LeftIndent
andFirstLineIndent
属性只存在于Microsoft.Office.Core.ParagraphFormat2
对象上。它们不存在于常规Microsoft.Office.Interop.PowerPoint.ParagraphFormat
对象上。
不过,您仍然可以更改整个 TextRange 的格式(不必按照上面的注释在段落级别完成)。
诀窍是访问您的形状的TextFrame2
属性,而不是仅仅访问TextFrame
,这将确保您返回的类是TextRange2
,这将返回 aParagraphFormat2
而不是常规的TextRange
and ParagraphFormat
。
以下代码对我有用:
myShape.TextFrame2.TextRange.ParagraphFormat.LeftIndent = (.13f * 72f); // .13 inches