How to create custom style using C#


I need to create a new style for one of the paragraph.
The following image shows how the custom styles being created in MS word.

custom-style.PNG (18.7 KB)

Can you please provide me a code snip to start my work?

Thanks in advance for your prompt reply in this regard.


Following code example shows how to create a new paragraph style. We suggest you please read the members of Style class. Hope this helps you.

Document doc = new Document();

// Create a paragraph style and specify some formatting for it
Style style = doc.Styles.Add(StyleType.Paragraph, "MyStyle1");
style.Font.Size = 24;
style.Font.Name = "Verdana";
style.ParagraphFormat.SpaceAfter = 12;