[]
        
(Showing Draft Content)

GrapeCity.Documents.Word.Fields.TocStyleLevelCollection

Class TocStyleLevelCollection

Namespace
GrapeCity.Documents.Word.Fields
Assembly
GcDocs.Word.dll

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
Inheritance
TocStyleLevelCollection
Implements
Inherited Members

Properties

Collect

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; }

Property Value

bool

Count

Gets the number of TocStyleLevel in this collection.

public int Count { get; }

Property Value

int

this[string]

Gets the TocStyleLevel associated with a specified style name.

public TocStyleLevel this[string name] { get; }

Parameters

name string

The style name.

Property Value

TocStyleLevel

The TocStyleLevel associated with name.

OutlineLevels

Gets the range of paragraph outline levels that should be collected by the TOC field when UseParagraphOutlineLevel is true.

public OutlineLevelRange OutlineLevels { get; }

Property Value

OutlineLevelRange

UseParagraphOutlineLevel

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; }

Property Value

bool

Methods

Add(string, OutlineLevel)

Adds the specified style to the collection.

public TocStyleLevel Add(string name, OutlineLevel displayLevel)

Parameters

name string

The style name.

displayLevel OutlineLevel

The outline level on which to display the collected paragraphs in the TOC field result.

Returns

TocStyleLevel

The newly created TocStyleLevel instance.

Exceptions

ArgumentException

Thrown when name is null or an empty string.

ArgumentException

Thrown when the style with the given name already exist in the collection.

Contains(string)

Gets a value indicating whether the collection contains a TocStyleLevel associated with a specified style name.

public bool Contains(string name)

Parameters

name string

The style name.

Returns

bool

true if the collection contains a TocStyleLevel associated with name, false otherwise.

GetEnumerator()

public IEnumerator<TocStyleLevel> GetEnumerator()

Returns

IEnumerator<TocStyleLevel>

Remove(string)

Removes a TocStyleLevel from the collection.

public bool Remove(string name)

Parameters

name string

The style name to remove.

Returns

bool

true if the TocStyleLevel was successfully found and removed, false otherwise.

ToString()

public override string ToString()

Returns

string

TryGetStyle(string, out TocStyleLevel)

Tries to get the TocStyleLevel associated with a specified style name.

public bool TryGetStyle(string name, out TocStyleLevel item)

Parameters

name string

The style name.

item TocStyleLevel

OUT: the TocStyleLevel associated with name.

Returns

bool

true if the collection contains a TocStyleLevel associated with name, false otherwise.