none
get value of foreground and bacjground color of ppt slides RRS feed

  • Question

  • I want to get foreground and background color value pf poewrpoint slides and calculate difference between them..

    i set background and foreground color through this code

    presentation.SlideMaster.Background.Fill.ForeColor.RGB = Color.FromArgb(0,23, 237, 251).ToArgb();
    presentation.SlideMaster.Background.Fill.BackColor.RGB =  System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.ForestGreen);

    and get values through this code..     

      int v al = presentation.SlideMaster.Background.Fill.ForeColor.RGB;
      int value = presentation.SlideMaster.Background.Fill.BackColor.RGB;

    it gives me 1568251 and 16777215.

    i cannot understand these value, how to i get original values and also how can i calculate differnce between them         


    Tuesday, September 23, 2014 8:09 PM

Answers

  • Hello Taimoor,

    The following example displays the value of the red, green, and blue components of the fill forecolor for shape one on slide one in the active document:

    Set myDocument = ActivePresentation.Slides(1)
    c = myDocument.Shapes(1).Fill.ForeColor.RGB
    redComponent = c Mod 256
    greenComponent = c \ 256 Mod 256
    blueComponent = c \ 65536 Mod 256
    MsgBox "RGB components: " & redComponent & _
        ", " & greenComponent & ", " & blueComponent

    Wednesday, September 24, 2014 8:28 AM

All replies