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

'' This sample demonstrates how to use theme colors
'' to change how a document looks.
Public Class ThemeColors
    Public Function CreateDocx() As GcWordDocument
        Dim doc = New GcWordDocument()
        Dim pth = Path.Combine("Resources", "WordDocs", "BuiltInStyles.docx")
        doc.Load(pth)

        '' Note prior to v2sp2 release of GcWord, Theme colors could be modified
        '' directly via GcWordDocument.Theme. In v2sp2 GlossaryDocument was added.
        '' GcWordDocument And GlossaryDocument are derived from the same DocumentBase
        '' class. Each can have their own theme colors, but there Is still only one
        '' Theme object, thus specific theme colors should be defined via Settings.
        ''
        '' So instead of code Like this:
        ''   doc.Theme.ColorScheme(ThemeColorId.Text1).RGB = Color.Blue
        '' now the following code should be used to modify the theme colors
        '' used in the document:

        doc.Settings.GetThemeColor(ThemeColorId.Text1).RGB = Color.Blue
        doc.Settings.GetThemeColor(ThemeColorId.Accent1).RGB = Color.Red
        doc.Settings.GetThemeColor(ThemeColorId.Accent2).RGB = Color.OrangeRed
        doc.Settings.GetThemeColor(ThemeColorId.Accent3).RGB = Color.Orange

        '' Done
        Return doc
    End Function
End Class