HyphenationOptions

HyphenationOptions class

允许配置文档连字选项。

要了解更多信息,请访问使用连字符文档文章。

public class HyphenationOptions

构造函数

姓名描述
HyphenationOptions()默认构造函数。

特性

姓名描述
AutoHyphenation { get; set; }获取或设置确定文档是否启用自动连字的值。 此属性的默认值为错误的.
ConsecutiveHyphenLimit { get; set; }获取或设置可以以连字符结尾的连续行的最大数量。 此属性的默认值为 0。
HyphenateCaps { get; set; }获取或设置确定全部大写字母的单词是否带连字符的值。 此属性的默认值为真的.
HyphenationZone { get; set; }获取或设置距离右边距 1/20 点的距离,在该距离内您不希望 对单词进行连字。 此属性的默认值为 360(0.25 英寸)。

例子

展示如何配置自动连字。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Font.Size = 24;
builder.Writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, " +
                "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");

doc.HyphenationOptions.AutoHyphenation = true;
doc.HyphenationOptions.ConsecutiveHyphenLimit = 2;
doc.HyphenationOptions.HyphenationZone = 720;
doc.HyphenationOptions.HyphenateCaps = true;

doc.Save(ArtifactsDir + "Document.HyphenationOptions.docx");

也可以看看