ThemeColors.cs
  1. //
  2. // This code is part of Document Solutions for Word demos.
  3. // Copyright (c) MESCIUS inc. All rights reserved.
  4. //
  5. using System;
  6. using System.Drawing;
  7. using System.IO;
  8. using GrapeCity.Documents.Word;
  9. using GrapeCity.Documents.Imaging;
  10.  
  11. namespace DsWordWeb.Demos
  12. {
  13. // This sample demonstrates how to use theme colors
  14. // to change how a document looks.
  15. public class ThemeColors
  16. {
  17. public GcWordDocument CreateDocx()
  18. {
  19. var doc = new GcWordDocument();
  20. var path = Path.Combine("Resources", "WordDocs", "BuiltInStyles.docx");
  21. doc.Load(path);
  22.  
  23. doc.Settings.GetThemeColor(ThemeColorId.Text1).RGB = Color.Blue;
  24. doc.Settings.GetThemeColor(ThemeColorId.Accent1).RGB = Color.Red;
  25. doc.Settings.GetThemeColor(ThemeColorId.Accent2).RGB = Color.OrangeRed;
  26. doc.Settings.GetThemeColor(ThemeColorId.Accent3).RGB = Color.Orange;
  27.  
  28. // Done:
  29. return doc;
  30. }
  31. }
  32. }
  33.