VegaRise.NET
Back to DOM

DocumentStylesClass

Definition

Namespace
DOM.Styles
Assembly
DOM.dll

Container for all document-level style collections and theme references.

Remarks

centralizes style-related data used by a document: the document's default styles, the registry of built-in (named) styles, and the available themes. Rendering, editing and serialization code should consult this object to apply consistent styling across newly created or existing elements. DocumentStyles This object is exposed on and on . VDocs.DocumentStyles Document.DocumentStyles

Examples

csharp
1// 1. Configure default styles
2doc.DocumentStyles.DocumentDefualtStyles = new DocumentDefualtStyles
3{
4 TextStyle = new TextStyle { Font = new Font("Calibri", 11.0) }
5};
6
csharp
1// 2. Register a custom named style
2doc.DocumentStyles.DocumentBuiltInStyles = new List<IBuiltInStyle>
3{
4 new BuiltInStyle
5 {
6 StyleId = "MyQuote",
7 Name = "Block Quote",
8 Type = StyleValues.Paragraph,
9 BasedOn = "Normal"
10 }
11};
12
csharp
1// 3. Register available themes
2doc.DocumentStyles.Themes = new List<ITheme>
3{
4 new Theme { Name = "Office" },
5 new Theme { Name = "Apex" }
6};
7
csharp
1// 4. Combined configuration
2doc.DocumentStyles = new DocumentStyles
3{
4 DocumentDefualtStyles = new DocumentDefualtStyles
5 {
6 TextStyle = new TextStyle { Font = new Font("Cambria", 12.0) }
7 },
8 DocumentBuiltInStyles = new List<IBuiltInStyle>(),
9 Themes = new List<ITheme> { new Theme { Name = "Office" } }
10};
11
csharp
1// 5. Read the default style while rendering
2var defaultTextStyle = doc.DocumentStyles?.DocumentDefualtStyles?.TextStyle;
3

Properties

DocumentBuiltInStylesIBuiltInStyle

Gets or sets the collection of named built-in styles available in the document.

DocumentDefualtStylesIDocumentDefualtStyles

Gets or sets the document default style set.

ThemesITheme

Gets or sets the collection of themes available to the document.

VegaRiseVDocs.NET

Reset Password

Enter your email and we'll send you a link to reset your password.

Remember your password? Sign in