@@ -30,6 +30,7 @@ export class Chart extends Shape implements IChart {
3030 relTypeChartColorStyle : string ;
3131 relTypeChartStyle : string ;
3232 relTypeChartImage : string ;
33+ relTypeChartThemeOverride : string ;
3334 wbRelsPath : string ;
3435 styleRelationFiles : {
3536 [ key : string ] : string [ ] ;
@@ -57,6 +58,8 @@ export class Chart extends Shape implements IChart {
5758 'http://schemas.microsoft.com/office/2011/relationships/chartStyle' ;
5859 this . relTypeChartImage =
5960 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image' ;
61+ this . relTypeChartThemeOverride =
62+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride' ;
6063 this . styleRelationFiles = { } ;
6164 }
6265
@@ -240,6 +243,7 @@ export class Chart extends Shape implements IChart {
240243 await this . appendChartToContentType ( ) ;
241244 await this . appendColorToContentType ( ) ;
242245 await this . appendStyleToContentType ( ) ;
246+ await this . appendThemeOverrideToContentType ( ) ;
243247 }
244248
245249 async copyChartFiles ( ) : Promise < void > {
@@ -292,13 +296,28 @@ export class Chart extends Shape implements IChart {
292296 ) ;
293297 }
294298 }
299+
300+ if ( this . styleRelationFiles . relTypeChartThemeOverride ?. length ) {
301+ const sourceFile =
302+ this . styleRelationFiles . relTypeChartThemeOverride [ 0 ] . replace (
303+ '../theme/' ,
304+ '' ,
305+ ) ;
306+ await FileHelper . zipCopy (
307+ this . sourceArchive ,
308+ `ppt/theme/${ sourceFile } ` ,
309+ this . targetArchive ,
310+ `ppt/theme/themeOverride${ this . targetNumber } .xml` ,
311+ ) ;
312+ }
295313 }
296314
297315 async getChartStyles ( ) : Promise < void > {
298316 const styleTypes = [
299317 'relTypeChartStyle' ,
300318 'relTypeChartColorStyle' ,
301319 'relTypeChartImage' ,
320+ 'relTypeChartThemeOverride' ,
302321 ] ;
303322
304323 for ( const i in styleTypes ) {
@@ -393,6 +412,14 @@ export class Chart extends Shape implements IChart {
393412 imageInfo ,
394413 ) ;
395414 break ;
415+ case this . relTypeChartThemeOverride :
416+ this . updateTargetWorksheetRelation (
417+ targetRelFile ,
418+ element ,
419+ 'Target' ,
420+ `../theme/themeOverride${ this . targetNumber } .xml` ,
421+ ) ;
422+ break ;
396423 }
397424 contentTracker . trackRelation ( targetRelFile , {
398425 Id : element . getAttribute ( 'Id' ) ,
@@ -480,6 +507,15 @@ export class Chart extends Shape implements IChart {
480507 ) ;
481508 }
482509
510+ appendThemeOverrideToContentType ( ) : Promise < XmlElement > {
511+ return XmlHelper . append (
512+ XmlHelper . createContentTypeChild ( this . targetArchive , {
513+ PartName : `/ppt/theme/themeOverride${ this . targetNumber } .xml` ,
514+ ContentType : `application/vnd.openxmlformats-officedocument.themeOverride+xml` ,
515+ } ) ,
516+ ) ;
517+ }
518+
483519 static async getAllOnSlide (
484520 archive : IArchive ,
485521 relsPath : string ,
0 commit comments