Class Style
Inheritance
System.Object
Style
Assembly: IronPPT.dll
Syntax
public class Style : DocumentStyle, IDocumentStyle, IStyle
Reach for Style to define a reusable named style that paragraphs and runs in a presentation can share. It bundles paragraph formatting and text formatting under one name, so a developer can change a heading's look in one place and have every element that uses that style update with it.
A Style is registered in the presentation's style set and then referenced by other elements. Its formatting lives in two slots: ParagraphStyle (an IParagraphStyle) holds spacing, indentation, and alignment, while TextStyle (an ITextStyle) holds bold, italic, color, and size. Identity and behavior come from StyleName, the readable name; StyleType, a Nullable<StyleValues> that marks whether the style applies to paragraphs, characters, or another target; and IsPrimaryStyle, a Nullable<bool> flagging it as the document's default. The inherited StyleId and Status (from DocumentStyle) carry the underlying identifier and state.
Use BasedOn to inherit from another style by name, setting only the properties that differ, and NextParagraphStyle to chain the style applied to the following paragraph, the familiar "Heading then Body" sequence. The StyleType value matters here because it tells IronPPT what the style targets, so a character style and a paragraph style with the same name stay distinct. Mark the deck's default with IsPrimaryStyle so unstyled content falls back to a known look. Build a base style, derive variants with BasedOn, and assign TextStyle and ParagraphStyle for the specifics so a deck's typography stays consistent without repeating formatting on every element.
var style = new Style();
style.StyleName = "Heading1";
style.TextStyle.IsBold = true;
The paragraph style example styles paragraph formatting, the add paragraph example builds the paragraphs a style applies to, and the add text how-to places the text a text style formats.
Constructors
Style()
Declaration
Properties
BasedOn
Declaration
public string BasedOn { get; set; }
Property Value
| Type |
Description |
| System.String |
|
IsPrimaryStyle
Declaration
public Nullable<bool> IsPrimaryStyle { get; set; }
Property Value
| Type |
Description |
| System.Nullable<System.Boolean> |
|
NextParagraphStyle
Declaration
public string NextParagraphStyle { get; set; }
Property Value
| Type |
Description |
| System.String |
|
ParagraphStyle
Declaration
public IParagraphStyle ParagraphStyle { get; set; }
Property Value
StyleName
Declaration
public string StyleName { get; set; }
Property Value
| Type |
Description |
| System.String |
|
StyleType
Declaration
public Nullable<StyleValues> StyleType { get; set; }
Property Value
TextStyle
Declaration
public ITextStyle TextStyle { get; set; }
Property Value
Implements