Back to DOM
BaseStyleClass
Definition
- Namespace
- DOM.Abstracts
- Assembly
- DOM.dll
Base class for style elements.
Remarks
is the abstract root of the style hierarchy. It carries, which every style uses to express "this style inherits from another style". Consumers should resolve the referenced style and merge properties when a nullable property is not set on the current style. BaseStyle ReferenceStyleId Concrete styles include,,,,,,, and others. TextStyle ParagraphStyle TableStyle BorderStyle Margin FontPart Underline
Examples
csharp
1// 1. Assign a reference style id
2var style = new TextStyle { ReferenceStyleId = "BodyText" };
3
csharp
1// 2. Override only one property from the referenced style
2var heading = new TextStyle
3{
4 ReferenceStyleId = "BodyText",
5 Font = new Font { Latin = new FontPart { FontName = "Calibri Light", Size = 20.0 } }
6};
7
csharp
1// 3. Resolve the reference when serializing
2string? baseId = heading.ReferenceStyleId;
3
csharp
1// 4. Type-check for a style element
2if (element is BaseStyle s) { /* apply style */ }
3
Properties
ReferenceStyleId
Gets or sets the identifier of the style this style inherits from.
The referenced style is looked up in the document's built-in styles collection. When a nullable property on this style is, the value from the referenced style (and its own reference chain) is used. null