get_effective_value method

get_effective_value(index, number_style, custom_number_style_format)

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.

def get_effective_value(self, index: int, number_style: aspose.words.NumberStyle, custom_number_style_format: str):
    ...
ParameterTypeDescription
indexintThe index of the list item (must be in the range from 1 to 32767).
number_styleNumberStyleThe NumberStyle of the ListLevel object.
custom_number_style_formatstrThe optional format string used when NumberStyle.CUSTOM is specified (e.g. “a, ç, ĝ, …”). In other cases, this parameter must be None 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 isNone or empty when the numberStyle is custom.-or-customNumberStyleFormat is notNone 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.

doc = aw.Document(MY_DIR + "List with leading zero.docx")

list_level = doc.first_section.body.paragraphs[0].list_format.list_level

custom_number_style_format = ""

if list_level.number_style == aw.NumberStyle.CUSTOM:
    custom_number_style_format = list_level.custom_number_style_format

self.assertEqual("001, 002, 003, ...", custom_number_style_format)

# We can get value for the specified index of the list item.
self.assertEqual("iv", list_level.get_effective_value(4, aw.NumberStyle.LOWERCASE_ROMAN, None))
self.assertEqual("005", list_level.get_effective_value(5, aw.NumberStyle.CUSTOM, custom_number_style_format))

See Also