[英]How to save Color Scheme in ppt application c# vsto
我想知道是否可以使用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);
//????
}
它將顏色方案添加到演示文稿中,並在“設計”選項卡中添加顏色方案。 當我選擇其他配色方案時,地雷將從“設計”選項卡中消失:(
我需要它一直在那里。
該主題需要物理存在於用戶個人資料上,以便每次都在“設計”選項卡上列出。 將主題保存在以下位置:“%AppData%\\ Microsoft \\ Templates \\ Document Themes”
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);
這個作品。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.