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)
ParameterTypeDescription
indexnumberThe index of the list item (must be in the range from 1 to 32767).
numberStyleNumberStyleThe NumberStyle of the ListLevel object.
customNumberStyleFormatstringThe 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

exceptioncondition
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