PPT VSTO根据存储的颜色变量设置字体颜色

objTextRng.Font.Color.RGB = System.Drawing.ColorTranslator.ToOl(System.Drawing.Color.Blue);

 private int BGR(Color color)
    {
        // PowerPoint's color codes seem to be reversed (i.e., BGR) not RGB
        //      0x0000FF    produces RED not BLUE
        //      0xFF0000    produces BLUE not RED
        // so we have to produce the color "in reverse"

        int iColor = color.R + 0xFF * color.G + 0xFFFF * color.B;

        return iColor;
    }
shape.TextFrame.TextRange.Font.Color.RGB = BGR(Color.Red); 


来源https://stackoverflow.com/questions/5247135/how-can-i-change-the-font-%20color-of-a-textrange-in-powerpoint-from-c

posted @ 2022-03-15 10:32  多见多闻  阅读(194)  评论(0)    收藏  举报