getEffectiveValue method
getEffectiveValue(index, numberStyle, customNumberStyleFormat)
Reports the string representation of the ListLevel object for the specified index of the list item. Parameters specify the NumberStyle and an optional format string used when NumberStyle.Custom is specified.
getEffectiveValue(index: number, numberStyle: Aspose.Words.NumberStyle, customNumberStyleFormat: string)
Parameter | Type | Description |
---|---|---|
index | number | The index of the list item (must be in the range from 1 to 32767). |
numberStyle | NumberStyle | The NumberStyle of the ListLevel object. |
customNumberStyleFormat | string | The optional format string used when NumberStyle.Custom is specified (e.g. “a, ç, ĝ, …”). In other cases, this parameter must be null or empty. |
Returns
The string representation of the ListLevel object, described by the numberStyle parameter and thecustomNumberStyleFormat parameter, in the list item at the position determined by theindex parameter.
Exceptions
exception | condition |
---|---|
RuntimeError (Proxy error(ArgumentException)) | customNumberStyleFormat isnull or empty when the numberStyle is custom.-or-customNumberStyleFormat is notnull or empty when the numberStyle is non-custom.-or-customNumberStyleFormat is invalid. |
RuntimeError (Proxy error(ArgumentOutOfRangeException)) | index is out of range. |
Examples
Shows how to get the format for a list with the custom number style.
let doc = new aw.Document(base.myDir + "List with leading zero.docx");
let listLevel = doc.firstSection.body.paragraphs.at(0).listFormat.listLevel;
let customNumberStyleFormat = '';
if (listLevel.numberStyle == aw.NumberStyle.Custom)
customNumberStyleFormat = listLevel.customNumberStyleFormat;
expect(customNumberStyleFormat).toEqual("001, 002, 003, ...");
// We can get value for the specified index of the list item.
expect(aw.Lists.ListLevel.getEffectiveValue(4, aw.NumberStyle.LowercaseRoman, null)).toEqual("iv");
expect(aw.Lists.ListLevel.getEffectiveValue(5, aw.NumberStyle.Custom, customNumberStyleFormat)).toEqual("005");
See Also
- module Aspose.Words.Lists
- class ListLevel