GetEffectiveValue

ListLevel.GetEffectiveValue method

يعرض التمثيل النصي لـListLevelكائن لـ index المحدد لعنصر القائمة. تحدد المعلماتNumberStyle وتنسيق اختياري string يستخدم عندCustom تم تحديده.

public static string GetEffectiveValue(int index, NumberStyle numberStyle, 
    string customNumberStyleFormat)
معامليكتبوصف
indexInt32فهرس عنصر القائمة (يجب أن يكون في النطاق من 1 إلى 32767).
numberStyleNumberStyleالNumberStyle التابعListLevel الكائن.
customNumberStyleFormatStringسلسلة التنسيق الاختيارية المستخدمة عندCustom يتم تحديد (على سبيل المثال “a, ç, ĝ, …”). في حالات أخرى، يجب أن تكون هذه المعلمةباطل أو فارغ.

قيمة الإرجاع

التمثيل النصي لـListLevel الكائن الذي تم وصفه بواسطةnumberStyle المعلمة and customNumberStyleFormat المعلمة، في عنصر القائمة في الموضع الذي تم تحديده بواسطةindex المعلمة.

استثناءات

استثناءحالة
ArgumentExceptioncustomNumberStyleFormat يكونباطل أو فارغة عندماnumberStyle هو مخصص.-أو- customNumberStyleFormat ليس كذلكباطل أو فارغة عندماnumberStyle غير مخصص.-أو- customNumberStyleFormat غير صالح.
ArgumentOutOfRangeExceptionالمؤشر خارج النطاق.

أمثلة

يوضح كيفية الحصول على تنسيق القائمة باستخدام نمط الرقم المخصص.

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));

أنظر أيضا