GetEffectiveValue
Contenuti
[
Nascondere
]ListLevel.GetEffectiveValue method
Segnala la rappresentazione in formato stringa delListLevel
oggetto per l’indice specificato dell’elemento dell’elenco. I parametri specificano l’NumberStyle
e una stringa di formato opzionale utilizzata quandoCustom è specificato.
public static string GetEffectiveValue(int index, NumberStyle numberStyle,
string customNumberStyleFormat)
Parametro | Tipo | Descrizione |
---|---|---|
index | Int32 | L’indice dell’elemento dell’elenco (deve essere compreso tra 1 e 32767). |
numberStyle | NumberStyle | IlNumberStyle delListLevel oggetto. |
customNumberStyleFormat | String | La stringa di formato facoltativa utilizzata quandoCustom è specificato (ad esempio “a, ç, ĝ, …”). In altri casi, questo parametro deve esserenull o vuoto. |
Valore di ritorno
La rappresentazione della stringaListLevel
oggetto, descritto dalnumberStyle parametro and ilcustomNumberStyleFormat parametro, nell’elemento dell’elenco nella posizione determinata dalindex parametro.
Eccezioni
eccezione | condizione |
---|---|
ArgumentException | customNumberStyleFormat Ènull o vuoto quando ilnumberStyle è personalizzato.-o- customNumberStyleFormat non ènull o vuoto quando ilnumberStyle non è personalizzato.-o- customNumberStyleFormat non è valido. |
ArgumentOutOfRangeException | l’indice è fuori intervallo. |
Esempi
Mostra come ottenere il formato per un elenco con lo stile numerico personalizzato.
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);
// Possiamo ottenere il valore per l'indice specificato dell'elemento dell'elenco.
Assert.AreEqual("iv", ListLevel.GetEffectiveValue(4, NumberStyle.LowercaseRoman, null));
Assert.AreEqual("005", ListLevel.GetEffectiveValue(5, NumberStyle.Custom, customNumberStyleFormat));
Guarda anche
- enum NumberStyle
- class ListLevel
- spazio dei nomi Aspose.Words.Lists
- assemblea Aspose.Words