Paragraph styles are rich text styles that can be applied to paragraph elements. A paragraph style contains two rules - ParagraphRule and InlineRule. The first one is used to style the paragraph the style is applied to and the second one is used to style each of the inlines in this paragraph. The example below demonstrates how to create a custom paragraph style and apply it to a paragraph element:
Example Title |
Copy Code
|
---|---|
NParagraphStyle customStyle = new NParagraphStyle("CustomStyle"); customStyle.ParagraphRule = new NParagraphRule(); customStyle.ParagraphRule.Border = new NBorderRule(ENPredefinedBorderStyle.Dash, NColor.Red, new NMargins(1)); customStyle.ParagraphRule.HorizontalAlignment = ENAlign.Center; customStyle.ParagraphRule.Padding = new NMargins(20); customStyle.InlineRule = new NInlineRule(); customStyle.InlineRule.Fill = new NColorFill(NColor.Blue); customStyle.Apply(paragraph2); |
As a result of this style, the styled paragraph will look like this: