GetEnumerator
StyleCollection.GetEnumerator method
Gets an enumerator object that will enumerate styles in the alphabetical order of their names.
public IEnumerator<Style> GetEnumerator()
Examples
Shows how to access a document’s style collection.
Document doc = new Document();
Assert.AreEqual(4, doc.Styles.Count);
// Enumerate and list all the styles that a document created using Aspose.Words contains by default.
using (IEnumerator<Style> stylesEnum = doc.Styles.GetEnumerator())
{
while (stylesEnum.MoveNext())
{
Style curStyle = stylesEnum.Current;
Console.WriteLine($"Style name:\t\"{curStyle.Name}\", of type \"{curStyle.Type}\"");
Console.WriteLine($"\tSubsequent style:\t{curStyle.NextParagraphStyleName}");
Console.WriteLine($"\tIs heading:\t\t\t{curStyle.IsHeading}");
Console.WriteLine($"\tIs QuickStyle:\t\t{curStyle.IsQuickStyle}");
Assert.AreEqual(doc, curStyle.Document);
}
}
See Also
- class Style
- class StyleCollection
- namespace Aspose.Words
- assembly Aspose.Words