我想知道是否可以使用C#vsto ppt加载项以编程方式保存ppt文档的颜色。
我有逻辑将其保存为当前文档
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
pptApp = this.Application;
pptApp.AfterNewPresentation += new Microsoft.Office.Interop.PowerPoint.EApplication_AfterNewPresentationEventHandler(pptApp_AfterNewPresentation);
}
private void pptApp_AfterNewPresentation(PowerPoint.Presentation pres)
{
AddTheme(pres);
}
private void AddTheme(PowerPoint.Presentation pres)
{
pres.ApplyTheme(theme);
PowerPoint.ColorScheme myScheme = Globals.ThisAddIn.Application.ActiveWindow.View.Slide.ColorScheme;
Globals.ThisAddIn.Application.ActivePresentation.ColorSchemes.Add(myScheme);
//????
}
它在设计选项卡中为演示文稿和配色方案添加了配色方案。
当我选择其他配色方案时,我的设计标签正在消失:(
我需要它永远在那里。
答案 0 :(得分:0)
主题需要实际出现在用户配置文件中,以便每次都在“设计”选项卡上列出。将主题保存在此位置: "%AppData%\ Microsoft \ Templates \ Document Themes"
答案 1 :(得分:0)
String programfilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
String msOfficePath = "Microsoft\\Templates\\Document Themes\\Test.thmx";
String fullPath = Path.Combine(programfilesPath, msOfficePath);
Globals.ThisAddIn.Application.ActivePresentation.SaveCopyAs(fullPath);
这个有效。