Class DocumentStyle
Inheritance
Implements
Namespace: IronWord.Models.Abstract
Assembly: IronWord.dll
Syntax
public abstract class DocumentStyle : Object
Sharing common style identity across a document in C# is what DocumentStyle underpins. It is the base that a defined style descends from, giving any style a stable identifier and a change-tracking flag so IronWord can apply, copy, and persist it consistently. The concrete style type that extends it in the library is Style, which a developer normally works with directly.
A DocumentStyle is obtained as the base of a Style you build or read from a document, not created on its own, since the type is abstract. StyleId is the name that ties content to its style definition, and Status records whether the style is new, updated, or unchanged so the save pipeline writes the right state. Clone returns a deep copy when you want to derive a variant without altering the original. SetNoChangeStatusAsUpdated marks an otherwise-unchanged style as updated, which forces it to be re-emitted on save.
using IronWord.Models;
Style style = new Style();
style.StyleId = "Heading1";The add style text how-to applies styling to content, and the add text how-to shows where styled runs fit.
Constructors
DocumentStyle()
Declaration
protected DocumentStyle()
Fields
Status
Gets or sets the status of the Style, indicating whether it is new, updated, or deleted.
Declaration
public ElementStatus Status
Field Value
| Type | Description |
|---|---|
| IronSoftware.Abstractions.Word.ElementStatus |
Properties
StyleId
Gets or sets the predefined style.
Declaration
public string StyleId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
Clone()
Declaration
public abstract object Clone()
Returns
| Type | Description |
|---|---|
| System.Object |
SetNoChangeStatusAsUpdated()
Declaration
protected void SetNoChangeStatusAsUpdated()