示例#1
0
        private ColorScheme GenerateColorScheme()
        {
            ColorScheme colorScheme1 = new ColorScheme()
            {
                Name = "Office"
            };

            Dark1Color  dark1Color1  = new Dark1Color();
            SystemColor systemColor1 = new SystemColor()
            {
                Val = SystemColorValues.WindowText, LastColor = "000000"
            };

            dark1Color1.Append(systemColor1);

            Dark2Color       dark2Color1       = new Dark2Color();
            RgbColorModelHex rgbColorModelHex1 = new RgbColorModelHex()
            {
                Val = "44546A"
            };

            dark2Color1.Append(rgbColorModelHex1);

            Light1Color light1Color1 = new Light1Color();
            SystemColor systemColor2 = new SystemColor()
            {
                Val = SystemColorValues.Window, LastColor = "FFFFFF"
            };

            light1Color1.Append(systemColor2);

            Light2Color      light2Color1      = new Light2Color();
            RgbColorModelHex rgbColorModelHex2 = new RgbColorModelHex()
            {
                Val = "E7E6E6"
            };

            light2Color1.Append(rgbColorModelHex2);

            Accent1Color     accent1Color1     = new Accent1Color();
            RgbColorModelHex rgbColorModelHex3 = new RgbColorModelHex()
            {
                Val = "4472C4"
            };

            accent1Color1.Append(rgbColorModelHex3);

            Accent2Color     accent2Color1     = new Accent2Color();
            RgbColorModelHex rgbColorModelHex4 = new RgbColorModelHex()
            {
                Val = "ED7D31"
            };

            accent2Color1.Append(rgbColorModelHex4);

            Accent3Color     accent3Color1     = new Accent3Color();
            RgbColorModelHex rgbColorModelHex5 = new RgbColorModelHex()
            {
                Val = "A5A5A5"
            };

            accent3Color1.Append(rgbColorModelHex5);

            Accent4Color     accent4Color1     = new Accent4Color();
            RgbColorModelHex rgbColorModelHex6 = new RgbColorModelHex()
            {
                Val = "FFC000"
            };

            accent4Color1.Append(rgbColorModelHex6);

            Accent5Color     accent5Color1     = new Accent5Color();
            RgbColorModelHex rgbColorModelHex7 = new RgbColorModelHex()
            {
                Val = "5B9BD5"
            };

            accent5Color1.Append(rgbColorModelHex7);

            Accent6Color     accent6Color1     = new Accent6Color();
            RgbColorModelHex rgbColorModelHex8 = new RgbColorModelHex()
            {
                Val = "70AD47"
            };

            accent6Color1.Append(rgbColorModelHex8);

            var hyperlink1 = new DocumentFormat.OpenXml.Drawing.Hyperlink();
            RgbColorModelHex rgbColorModelHex9 = new RgbColorModelHex()
            {
                Val = "0563C1"
            };

            hyperlink1.Append(rgbColorModelHex9);

            FollowedHyperlinkColor followedHyperlinkColor1 = new FollowedHyperlinkColor();
            RgbColorModelHex       rgbColorModelHex10      = new RgbColorModelHex()
            {
                Val = "954F72"
            };

            followedHyperlinkColor1.Append(rgbColorModelHex10);

            colorScheme1.Append(dark1Color1);
            colorScheme1.Append(light1Color1);
            colorScheme1.Append(dark2Color1);
            colorScheme1.Append(light2Color1);
            colorScheme1.Append(accent1Color1);
            colorScheme1.Append(accent2Color1);
            colorScheme1.Append(accent3Color1);
            colorScheme1.Append(accent4Color1);
            colorScheme1.Append(accent5Color1);
            colorScheme1.Append(accent6Color1);
            colorScheme1.Append(hyperlink1);
            colorScheme1.Append(followedHyperlinkColor1);
            return(colorScheme1);
        }
示例#2
0
 public void ReadThemeSchemeColor(SchemeColor schemeColor)
 {
     if (schemeColor.Val == "bg1")
     {
         Light1Color light1Color = slide.SlideLayoutPart.SlideMasterPart.
                                   ThemePart.Theme.ThemeElements.ColorScheme.Light1Color;
         if (light1Color.RgbColorModelHex != null)
         {
             FontColor = "#" + light1Color.RgbColorModelHex.Val.Value;
         }
         else if (light1Color.SystemColor != null)
         {
             FontColor = "#" + light1Color.SystemColor.LastColor.Value;
         }
     }
     else if (schemeColor.Val == "bg2")
     {
         Light2Color light2Color = slide.SlideLayoutPart.SlideMasterPart.
                                   ThemePart.Theme.ThemeElements.ColorScheme.Light2Color;
         if (light2Color.RgbColorModelHex != null)
         {
             FontColor = "#" + light2Color.RgbColorModelHex.Val.Value;
         }
         else if (light2Color.SystemColor != null)
         {
             FontColor = "#" + light2Color.SystemColor.LastColor.Value;
         }
     }
     else if (schemeColor.Val == "tx1")
     {
         Dark1Color dark1Color = slide.SlideLayoutPart.SlideMasterPart.
                                 ThemePart.Theme.ThemeElements.ColorScheme.Dark1Color;
         if (dark1Color.RgbColorModelHex != null)
         {
             FontColor = "#" + dark1Color.RgbColorModelHex.Val.Value;
         }
         else if (dark1Color.SystemColor != null)
         {
             FontColor = "#" + dark1Color.SystemColor.LastColor.Value;
         }
     }
     else if (schemeColor.Val == "tx2")
     {
         Dark2Color dark2Color = slide.SlideLayoutPart.SlideMasterPart.
                                 ThemePart.Theme.ThemeElements.ColorScheme.Dark2Color;
         if (dark2Color.RgbColorModelHex != null)
         {
             FontColor = "#" + dark2Color.RgbColorModelHex.Val.Value;
         }
         else if (dark2Color.SystemColor != null)
         {
             FontColor = "#" + dark2Color.SystemColor.LastColor.Value;
         }
     }
     else if (schemeColor.Val == "hlink")
     {
         Hyperlink HyperLink = slide.SlideLayoutPart.SlideMasterPart.
                               ThemePart.Theme.ThemeElements.ColorScheme.Hyperlink;
         if (HyperLink.RgbColorModelHex != null)
         {
             FontColor = "#" + HyperLink.RgbColorModelHex.Val.Value;
         }
     }
     else if (schemeColor.Val == "folHlink")
     {
         FollowedHyperlinkColor folHyperLink = slide.SlideLayoutPart.SlideMasterPart.
                                               ThemePart.Theme.ThemeElements.ColorScheme.FollowedHyperlinkColor;
         if (folHyperLink.RgbColorModelHex != null)
         {
             FontColor = "#" + folHyperLink.RgbColorModelHex.Val.Value;
         }
     }
     this.ReadAccentSchemeColors(schemeColor);
 }