コード例 #1
0
 /// <summary>
 /// Delete the current theme
 /// </summary>
 public void DeleteCurrentTheme()
 {
     if (CurrentTheme == null)
     {
         return;
     }
     _wb._package.ZipPackage.DeleteRelationship(_theme.RelationshipId);
     _wb._package.ZipPackage.DeletePart(_theme.ThemeUri);
     _theme = null;
 }
コード例 #2
0
 /// <summary>
 /// Loads a theme XmlDocument.
 /// Overwrites any previously set theme settings.
 /// </summary>
 /// <param name="themeXml">The theme xml</param>
 public void Load(XmlDocument themeXml)
 {
     DeleteCurrentTheme();
     if (CurrentTheme == null)
     {
         var uri  = new Uri("/xl/theme/theme1.xml", UriKind.Relative);
         var part = _wb._package.ZipPackage.CreatePart(uri, ContentTypes.contentTypeTheme);
         themeXml.Save(part.GetStream());
         var rel = _wb.Part.CreateRelationship(uri, TargetMode.Internal, ExcelPackage.schemaThemeRelationships);
         _theme = new ExcelTheme(_wb, rel);
     }
 }