Nevron Open Vision Documentation
Bullet List Templates

Each bullet list has an associated bullet list template, which controls how the bullets generated by this list are formatted. The following sections discuss how to work with bullet list templates:

Creating Bullet List Templates

You create a bullet list template by creating an instance of the NBulletListTemplate class. For example:

Creating Bullet List Templates
Copy Code
// create a bullet list template
NBulletListTemplate customTemplate = new NBulletListTemplate();
            
// create a bullet list template level
NBulletListLevel bulletListLevel1 = new NBulletListLevel();
bulletListLevel1.Format = "\\0.";
customTemplate.ListLevels.Add(bulletListLevel1);

// create a bullet list that uses that template
NBulletList bulletList = new NBulletList();
bulletList.Template = customTemplate;

// add bullet list items...

This code creates a bullet list template with one level. Each bullet list template consist of one or more levels that you add to the ListLevels collection of that template. Each bullet list template level is responsible for formatting the bullets generated by bullet list items for that level. For example if you have a bullet list that contains another bullet list the bullets generated by the first one will be formatted using the properties of the first bullet list level, whereas the bullets generated by its child bullet list will be formatted using the properties of the second bullet list level.

Bullet Format

Each bullet list template level has a property called Format which allows you to specify the text displayed by the bullets for that level. The string value you pass there can contain either plain characters or backward slash followed by level number. For example in the code above the format is set to "\0.", meaning that the formatted counter value for level 1 is followed by dot. If you create a second bullet list level it will typically use "\0.\1." and so on. In general by placing a back slash followed by level number you create a place holder for formatted counter values, which you can mix with arbitrary characters.

Setting Bullet Format
Copy Code
bulletListLevel1.Format = "\\0.";
Bullet Type

The bullet list template level has a property called BulletType which controls how counter values are formatted for this particular level. The following table lists the available options:

ENBulletType Description
Text Bullet specified from the bullet char property.
Decimal Arabic numbers - 1, 2, 3, 4, etc.
LowerRoman Lower case roman numbers - i, ii, iii, iv, etc.
UpperRoman Upper case roman numbers - I, II, III, IV, etc.
LowerAlpha Lower case letters - a, b, c, d, etc.
UpperAlpha Upper case letters - A, B, C, D, etc.
OrdinalEnglish Ordinal number - 1st, 2nd, 3rd, 4th, etc.
CardinalTextEnglish Cardinal text number - One, Two Three, Four, etc.
OrdinalTextEnglish Ordinal text number - First, Second, Third, Fourth, etc.

The following example shows how to create a bullet list level that specifies filled circle as the bullet text:

Setting Bullet Type
Copy Code
// create a bullet list template
NBulletListTemplate customTemplate = new NBulletListTemplate();
            
// create a bullet list template level
NBulletListLevel bulletListLevel1 = new NBulletListLevel();

// set the bullet type to text and bullet text to unicode char for filled bullet circle
bulletListLevel1.BulletType = ENBulletType.Text;
bulletListLevel1.BulletText = new string((char)0x25CF, 1);
customTemplate.ListLevels.Add(bulletListLevel1);

// add the template the to the bullet list templates
someBulletList.Template = customTemplate;

 Note that the code above species a special char for the bullet text. The control provides the ENBulletChar enum which provides commonly used Unicode bullet chars:

ENBulletChar Description
None Empty bullet char. Unicode code point 0x0000.
BlackCircle Standard bullet char (disc, black circle). Unicode code point 0x25CF.
BlackTrianngle Triangular bullet char. Unicode code point 0x2023.
BlackSquare Filled suqare char. Unicode code point 0x25A0.
WhiteSquare White square char. Unicode code point 0x25A1.
WhiteCircle White circle char. Unicode code point 0x25CB.
Hyphen Hyphen bullet. Unicode code point 0x2043.
Asterisk Asterisk. Unicode code point 0x002A.

The following code snippet shows how to use the values in this enum:

Using Common Bullet Chars
Copy Code
bulletListLevel1.BulletText = new string((char)ENBulletChar.TriangularBullet, 1);

 

Bullet Tab Stop

The generated bullet text can optionally be followed by a space or tab character. This is controlled from the BulletFollowChar property accepting values from the ENBulletFollowChar enum:

ENBulletFollowChar Description
None No char follows the bullet.
Space The bullet is followed by space.
Tab The bullet is followed by tab. The tab stop can be controlled from the TabStop property of the list level.

 

Adding tabs that follow the bullets help to increase readability when the bullet list uses bullets embedded in paragraphs. The following code snippet shows how to create a bullet followed by a tab stop at 40 dips:

Adding Tab Stops After the Bullet
Copy Code
bulletListLevel1.BulletFollowChar = ENBulletFollowChar.Tab;
bulletListLevel1.TabStop = new NTabStop(40, ENTabStopAlignment.Left, ENTabStopLeaderStyle.None);

 

See Also
Send Feedback