简体   繁体   中英

custClrList of PowerPoint presentation

I'm using Microsoft.Office.Interop.PowerPoint library to work with PowerPoint presentations and looking for a way to programmatically modify 'Custom Colors' section of color palette. I can see that it's stored inside 'custClrList' tag in ppt->theme files and can be modified manually, but not sure how to access it from the code.

In PowerPoint custom colors are saved to the XML file, so if you want to re-use it on another machines you need to think including such files to the installer. For example, here is a VBA sample which creates a custom theme and saves it to a file:

Sub mkThemeCols()
With ActivePresentation.SlideMaster.Theme
.ThemeColorScheme(msoThemeAccent1) = RGB(255, 0, 0)
.ThemeColorScheme(msoThemeAccent2) = RGB(0, 255, 0)
.ThemeColorScheme(msoThemeAccent3) = RGB(0, 255, 255)
.ThemeColorScheme(msoThemeAccent4) = RGB(255, 255, 0)
.ThemeColorScheme(msoThemeAccent5) = RGB(23, 255, 10)
.ThemeColorScheme(msoThemeAccent6) = RGB(23, 255, 100)
.ThemeColorScheme(msoThemeDark1) = RGB(23, 0, 0)
.ThemeColorScheme(msoThemeDark2) = RGB(23, 23, 23)
.ThemeColorScheme.Save Environ("APPDATA") & "\Microsoft\Templates\Document Themes\Theme Colors\myNew Theme.xml"
End With
End Sub

It is also possible to add XML so that there are extra color schemes that travel with the presentation (method on Echo Swinford's site )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM