[]
Represents a collection of built-in and user-defined styles in a document.
public class StyleCollection : IReadOnlyList<Style>, IReadOnlyCollection<Style>, IEnumerable<Style>, IEnumerable
Gets the number of styles in the collection.
public int Count { get; }
Gets document default text formatting.
public FontBase DefaultFont { get; }
Gets document default paragraph formatting.
public ParagraphFormat DefaultParagraphFormat { get; }
Gets or sets the interval (in points) between the default tab stops.
public float DefaultTabStop { get; set; }
Gets the parent document.
public DocumentBase Document { get; }
Gets a built-in style by its locale independent identifier.
public Style this[BuiltInStyleId id] { get; }
id
BuiltInStyleIdThe BuiltInStyleId value that specifies the built in style to retrieve.
The built-in style.
Gets a style by its index.
public Style this[int index] { get; }
index
intThe index of a style index in the collection.
The style with the specified index.
Gets a style by name or alias.
public Style this[string name] { get; }
name
stringA style name or alias.
The style with the specified name or alias.
Creates a new user defined style and adds it to the document.
public Style Add(string name, Style baseStyle)
The newly created style.
Creates a new user defined style and adds it to the document.
public Style Add(string name, StyleType type)
The newly created style.
Adds a pair of linked paragraph and character styles to the collection.
public Style AddLinkedStyle(string name, Style baseStyle = null)
name
stringThe linked style name.
baseStyle
StyleA base paragraph or linked style.
A newly created linked paragraph style.
Checks whether this collection contains a style with a specified name.
public bool Contains(string name)
name
stringThe style name to check.
True if the collection contains a style with the specified name or alias, false otherwise.
Gets the style that is applied to objects that do not explicitly specify a style.
public Style GetDefaultStyle(StyleType type)
type
StyleTypeThe style type.
The default style or null.
Sets the style that is applied to objects that do not explicitly specify a style.
public void SetDefaultStyle(StyleType type, Style style)
Tries to get a style from the collection by its name.
public bool TryGetValue(string name, out Style style)
name
stringThe style name.
style
StyleWhen this method returns, contains the style with the specified name or alias if the style was found, or null otherwise.
True if the style with the specified name or alias was found, false otherwise.