DocX icon indicating copy to clipboard operation
DocX copied to clipboard

Number in NumberedList style

Open mirkovicmiroslav opened this issue 3 years ago • 1 comments

Hi,

How can we add style to Number in List? I'm trying to add Numbered List, with bold number and text.

My code:

var list = _document.AddList("Test", 0, ListItemType.Numbered, 1, false,false, new Formatting { Bold = true });
list.Items.ForEach(a => a.Bold().Alignment = Alignment.both);

Text is bold but not number isn't.

image

mirkovicmiroslav avatar Aug 29 '22 21:08 mirkovicmiroslav

Hi,

I don't think this is possible in the free version. With the Full version, available here : https://xceed.com/en/our-products/product/words-for-net, you can define specific listOptions, like bolding the ListItem numbers: var customNumberedListOptions = new ListOptions() { ListType = ListItemType.Numbered, LevelsConfigs = new ObservableCollection<ListLevelConfig>() { new ListLevelConfig() { NumberingFormat = NumberingFormat.decimalNormal, NumberingLevelText = "%1)", Justification = Justification.left, Indentation = new Indentation() { Hanging = 18f, Left = 16f }, Formatting = new Formatting() { FontColor = Color.DarkMagenta, Bold = true } } } }; var list = _document.AddList( customNumberedListOptions ); list.AddListItem( "Test" );

This is not possible in the free DocX version available on GitHub. You can try the full version for free for 15 days and see if it does what you wish.

XceedBoucherS avatar Aug 30 '22 16:08 XceedBoucherS