CustomNumberStyleFormat

ListLevel.CustomNumberStyleFormat property

获取此列表级别的自定义数字样式格式。例如:“a、ç、ĝ、…”.

public string CustomNumberStyleFormat { get; }

例子

演示如何获取具有自定义数字样式的列表的格式。

Document doc = new Document(MyDir + "List with leading zero.docx");

ListLevel listLevel = doc.FirstSection.Body.Paragraphs[0].ListFormat.ListLevel;

string customNumberStyleFormat = string.Empty;

if (listLevel.NumberStyle == NumberStyle.Custom)
    customNumberStyleFormat = listLevel.CustomNumberStyleFormat;

Assert.AreEqual("001, 002, 003, ...", customNumberStyleFormat);

// 我们可以获取列表项的指定索引的值。
Assert.AreEqual("iv", ListLevel.GetEffectiveValue(4, NumberStyle.LowercaseRoman, null));
Assert.AreEqual("005", ListLevel.GetEffectiveValue(5, NumberStyle.Custom, customNumberStyleFormat));

也可以看看