'' This code is part of GrapeCity Documents for Word samples.
'' Copyright (c) GrapeCity, Inc. All rights reserved.
Imports System.Drawing
Imports System.IO
Imports System.Linq
Imports GrapeCity.Documents.Word
Imports GrapeCity.Documents.Imaging

'' This sample lists all built-in styles available in GcWord.
Public Class ListBuiltInStyles
    Public Function CreateDocx() As GcWordDocument
        Dim doc = New GcWordDocument()
        Dim pars = doc.Body.Paragraphs

        pars.Add("List of All Built-in Styles", doc.Styles(BuiltInStyleId.Title))

        '' List all built-in style names and types.
        '' Note that BuiltInStyleId.User is a special case that is not associated
        '' with any built-in style. This value is returned by the Style.BuiltInId
        '' property for user-defined styles, but cannot be used as an index
        '' on the Styles collection (an exception will occur):
        For Each id In [Enum].GetValues(GetType(BuiltInStyleId))
            If id <> BuiltInStyleId.User Then
                pars.Add($"Style name '{doc.Styles(id).Name}', type: '{doc.Styles(id).Type}'.")
            End If

        '' Done:
        Return doc
    End Function
End Class