1- import { vd } from './helper/general-helper' ;
2- import Automizer , { modify , ModifyTextHelper , XmlHelper } from './index' ;
3- import { XmlElement } from './types/xml-types' ;
4-
5- // const automizer = (outputName) =>
6- // new Automizer({
7- // templateDir: `${__dirname}/../__tests__/pptx-templates`,
8- // outputDir: `${__dirname}/../__tests__/pptx-output`,
9- // // You can enable 'archiveType' and set mode: 'fs'
10- // // This will extract all templates and output to disk.
11- // // It will not improve performance, but it can help debugging:
12- // // You don't have to manually extract pptx contents, which can
13- // // be annoying if you need to look inside your files.
14- // archiveType: {
15- // mode: 'fs',
16- // baseDir: `${__dirname}/../__tests__/pptx-cache`,
17- // workDir: outputName,
18- // // cleanupWorkDir: true,
19- // },
20- // rootTemplate: 'RootTemplate.pptx',
21- // presTemplates: [`SlidesWithAdditionalMaster.pptx`],
22- // removeExistingSlides: true,
23- // autoImportSlideMasters: true,
24- // cleanup: false,
25- // compression: 0,
26- // });
1+ import Automizer , { modify } from './index' ;
272
283const run = async ( ) => {
294 const automizer = new Automizer ( {
@@ -33,24 +8,19 @@ const run = async () => {
338 showIntegrityInfo : true ,
349 assertRelatedContents : true ,
3510 useCreationIds : true ,
36- // archiveType: {
37- // mode: 'fs',
38- // baseDir: `${__dirname}/../__tests__/pptx-cache`,
39- // workDir: `add-slide-master-auto-import.test.pptx`,
40- // // cleanupWorkDir: true,
41- // },
4211 } ) ;
4312
44- const pres = await automizer
45- . loadRoot ( `EmptyTemplate.pptx` )
46- . load ( 'SlideMasters.pptx' )
47- . load ( 'SlidesWithAdditionalMaster.pptx' )
13+ const pres = automizer
14+ . loadRoot ( `RootTemplate.pptx` )
15+ . load ( `SlideWithShapes.pptx` , 'shapes' ) ;
4816
49- . addSlide ( 'SlidesWithAdditionalMaster.pptx' , 1 , ( slide ) => {
50- slide . useSlideLayout ( 'Leer' ) ;
17+ const result = await pres
18+ . addSlide ( 'shapes' , 2 , ( slide ) => {
19+ slide . modifyElement ( 'Drum' , [ modify . rotateShape ( 45 ) ] ) ;
20+ slide . modifyElement ( 'Cloud' , [ modify . rotateShape ( - 45 ) ] ) ;
21+ slide . modifyElement ( 'Arrow' , [ modify . rotateShape ( 180 ) ] ) ;
5122 } )
52-
53- . write ( `add-slide-master-auto-import.test.pptx` ) ;
23+ . write ( `modify-shapes-rotate.test.pptx` ) ;
5424} ;
5525
5626run ( ) . catch ( ( error ) => {
0 commit comments