Hi there, i was wondering if someone could help. I am generating a list in a word document using OpenXML and i want to change the bullet point style (so instead of using the default square use the dot or something else). When i inspected the markup there was nothing specific about a list that had different styles as compared to the list that contained the style.
Can anyone please point me in the correct direction?
Thanks,
Ashwin
Hi Ashwin,
Here is an MSDN article that explains everything you need to know about numbering.
msdn.microsoft.com/.../ee922775(office.14).aspx
This will tell you how to change the bullet point.
-Eric
Hi Eric, thanks for the link, your article is really awesome and it's quite extensive. Although I still havent fully understood how to change the bullet points. Is the bullet point style defined in the abstract numbering part and so when the list is built somehow we have to reference that.
Thanks in advance.
The bullet symbols are defined as unicode characters in the w:lvlText element. The unicode characters (as used by default) are F076, F0D8, F0A7, F0B7, F0A8, F0FC. You can put whatever character you want in the w:lvlText element, and that will be used for the bullet for that level of list item. Remember, if you have multiple levels, you need to define bullets for each level. You can use the same unicode character, or you can use different characters for each level.
It is really amazing how flexible and powerful the numbering system is in Open XML. It is hard to imagine a numbering scheme that you could not cook up in Open XML.
Hi Eric.
Can you show how to set the LevelText (w:lvlText) from code for specific unicode character?
I tried
string unicode = "U+2022"; int p = int.Parse(unicode.Substring(2), System.Globalization.NumberStyles.HexNumber); var tt = Convert.ToString((char)p); var rr = char.ConvertFromUtf32(8226); new LevelText() { Val =tt }
and
new LevelText() { Val = rr }
but in the Word I see only a
In VS in debug mode I see the symbol I want.
When I copy the symbol to code it works ok
new LevelText() { Val = "•" },
I also set
new ParagraphProperties(new RunFonts() { Ascii="Symbol", HighAnsi="Symbol", Hint= FontTypeHintValues.Default })