[]
Represents a collection of styles for which paragraphs should be collected by the TOC field.
By default it contains all built-in heading styles like "Heading 1", "heading 2" etc.
public class TocStyleLevelCollection : IEnumerable<TocStyleLevel>, IEnumerable
Gets or sets a value indicating whether to collect paragraphs formatted with styles from the collection.
The default value is true.
If both Collect and Collect are false, this property returns true.
public bool Collect { get; set; }
Gets the number of TocStyleLevel in this collection.
public int Count { get; }
Gets the TocStyleLevel associated with a specified style name.
public TocStyleLevel this[string name] { get; }
name
stringThe style name.
The TocStyleLevel associated with name
.
Gets the range of paragraph outline levels that should be collected by the TOC field when UseParagraphOutlineLevel is true.
public OutlineLevelRange OutlineLevels { get; }
Gets or sets a value indicating whether to use outline level applied to paragraph instead of styles.
The default value is false.
If true, the TOC field collects paragraphs whose outline level corresponds to the OutlineLevels property.
Paragraphs formatted with custom styles listed in this collection will be collected unless their outline level is BodyText.
public bool UseParagraphOutlineLevel { get; set; }
Adds the specified style to the collection.
public TocStyleLevel Add(string name, OutlineLevel displayLevel)
name
stringThe style name.
displayLevel
OutlineLevelThe outline level on which to display the collected paragraphs in the TOC field result.
The newly created TocStyleLevel instance.
Thrown when name
is null or an empty string.
Thrown when the style with the given name already exist in the collection.
Gets a value indicating whether the collection contains a TocStyleLevel associated with a specified style name.
public bool Contains(string name)
name
stringThe style name.
true if the collection contains a TocStyleLevel associated with name
, false otherwise.
public IEnumerator<TocStyleLevel> GetEnumerator()
Removes a TocStyleLevel from the collection.
public bool Remove(string name)
name
stringThe style name to remove.
true if the TocStyleLevel was successfully found and removed, false otherwise.
public override string ToString()
Tries to get the TocStyleLevel associated with a specified style name.
public bool TryGetStyle(string name, out TocStyleLevel item)
name
stringThe style name.
item
TocStyleLevelOUT: the TocStyleLevel associated with name
.
true if the collection contains a TocStyleLevel associated with name
, false otherwise.