This project has moved and is read-only. For the latest updates, please go here.

Styling of numbered/bullet lists

Dec 17, 2013 at 11:38 PM
Hi, was wondering if anyone knew how I could go about styling the numbers/bullets that make up a list?

Thanks in advance!
Dec 22, 2013 at 1:32 PM
I've just commited a new version which should solve your problems:

Added two new methods:

InsertList(List list, double fontSize)
InsertList(List list, System.Drawing.FontFamily fontFamily, double fontSize)

and a new example of usage: DocumentsWithListsFontChange();

Thanks to those 2 methods you can easily set font family and font size when inserting new lists.

Hope it helps
Marked as answer by MadBoy on 12/22/2013 at 5:55 AM
Jan 9, 2014 at 10:59 PM
Apologies, was away for vacation and then forgot to check when I got back. Your change did work but I think you misunderstood what I
wanted to do. I was actually trying to figure how to styling the actual bullet/number on the list dynamically. For example if the list was:
  1. Something
I was trying to style the 1.
Jan 9, 2014 at 11:11 PM
There are couple of styles available:
        private static void AddList()

            using (var document = DocX.Create(@"docs\Lists.docx"))
                var numberedList = document.AddList("First List Item.", 0, ListItemType.Numbered, 2);
                document.AddListItem(numberedList, "First sub list item", 1);
                document.AddListItem(numberedList, "Second List Item.");
                document.AddListItem(numberedList, "Third list item.");
                document.AddListItem(numberedList, "Nested item.", 1);
                document.AddListItem(numberedList, "Second nested item.", 1);

                var bulletedList = document.AddList("First Bulleted Item.", 0, ListItemType.Bulleted);
                document.AddListItem(bulletedList, "Second bullet item");
                document.AddListItem(bulletedList, "Sub bullet item", 1);
                document.AddListItem(bulletedList, "Second sub bullet item", 1);
                document.AddListItem(bulletedList, "Third bullet item");

                Console.WriteLine("\tCreated: docs\\Lists.docx");
But that's about it. Nothing else has been done but you are welcome to implement it based on the source code you have.