Table of Contents

Table of Contents

FlexScript Class - PowerPoint.Slide

PowerPoint.Slide

Description

A class for managing and editing PowerPoint slides.

Properties

backgroundColor Gets/sets the slide's background color.
index Gets/sets the index of the slide in the presentation.
shapes Accesses shapes in the slide (Read Only).

Methods

addMedia Adds media to the slide, can be a sound or video file.
addPicture Adds a picture to the slide.
addTable Adds a table to the slide from a table in FlexSim.
addTextBox Adds a textbox to the slide.
assertTitleBox Asserts a title text box if the slide layout includes or included one.
delete Deletes the slide.
duplicate duplicates the slide.
setBackgroundColor Sets the slide's background color.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.backgroundColor

Color backgroundColor

Description

Gets/sets the slide's background color.


			  PowerPoint.Presentation presentation;
			  presentation.open(modeldir() + "\\Presentation.pptx", 1);
			  presentation.slides[1].backgroundColor = Color.red;
			  return presentation.slides[1].backgroundColor;
			

Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.index

int index

Description

Gets/sets the index of the slide in the presentation.


				PowerPoint.Presentation presentation;
				presentation.create(1);
				PowerPoint.Slide Slide1 = presentation.addSlide(PowerPoint.Layout.blank);
				PowerPoint.Slide Slide2 = presentation.addSlide(PowerPoint.Layout.blank);
				print(Slide1.index); //1
				Slide2.index = 1;  //The second slide is now the first slide in the presentation
				return Slide1.index; //2
			

Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.shapes

readonly PowerPoint.Shape shapes

Description

Accesses shapes in the slide (Read Only).

Accessing the Number of shapes in the presentation

You can access the number of shapes in the presentation with the following code.

slide.shapes.length

Accessing shapes by Rank

You can access an individual shape with the following code.


				slide.shapes[1] // first shape
				slide.shapes[slide.shapes.length] // last shape
				slide.shapes[i] // i-th shape
			

Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.addMedia()

PowerPoint.Shape addMedia( string filePath , Vec2 position , Vec2 size )

Parameters

filePath The path to the media file you want to add.
position The position of the media object, top left corner is 0, 0.
size The size of the media object.

Description

Adds media to the slide, can be a sound or video file.


			  PowerPoint.Presentation presentation = PowerPoint.Presentation.create(1);
			  presentation.addSlide(PowerPoint.Layout.blank);
			  presentation.slides[1].addMedia(modeldir() + "\\SampleVideo.mp4", Vec2(80,80),Vec2(200,200));
			
Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.addPicture()

PowerPoint.Shape addPicture( string filePath , Vec2 position , Vec2 size )

Parameters

filePath The path to the picture file you want to add.
position The position of the picture object, top left corner is 0, 0.
size The size of the picture object.

Description

Adds a picture to the slide.


			  PowerPoint.Presentation presentation = PowerPoint.Presentation.create(1);
			  presentation.addSlide(PowerPoint.Layout.blank);
			  presentation.slides[1].addPicture(modeldir() + "\\SamplePicture.png", Vec2(80,80),Vec2(200,200));
			
Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.addTable()

PowerPoint.Shape addTable( Table table , Vec2 position , Vec2 size , double fontSize = 18 )

Parameters

table The Table the data will be pulled from.
position The position of the table, top left corner is 0, 0.
size The size of the table. If the size is smaller than the space required to fill the table, it will autosize to accommodate.
fontSize The size of the font.

Description

Adds a table to the slide from a table in FlexSim.


			  PowerPoint.Presentation presentation = PowerPoint.Presentation.create(1);
			  presentation.addSlide(PowerPoint.Layout.blank);
			  presentation.slides[1].addMedia(Table("GlobalTable1"), Vec2(80,80),Vec2(200,200), 12);
			
Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.addTextBox()

PowerPoint.Shape addTextBox( string text , Vec2 position , Vec2 size , double fontSize = 18 , int bold = 0 , Color color = Color.black )

Parameters

text The text you want to be displayed.
position The position of the textbox, top left corner is 0, 0.
size The size of the textbox. The textbox will autosize to accommodate text that occupies a larger or smaller space then specified.
fontSize The size of the font.
bold Pass in a 1 to bold the text.
color Set the color of the text.

Description

Adds a textbox to the slide.


			  PowerPoint.Presentation presentation = PowerPoint.Presentation.create(1);
			  presentation.addSlide(PowerPoint.Layout.blank);
			  presentation.slides[1].addTextBox("New Text", Vec2(80, 80), Vec2(200, 50), 30, 0, Color.blue);
			
Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.assertTitleBox()

PowerPoint.Shape assertTitleBox( string text , Vec2 position , Vec2 size , double fontSize = 18 , int bold = 0 , Color color = Color.black )

Parameters

text The text you want to be displayed.
position The position of the textbox, top left corner is 0, 0.
size The size of the textbox. The textbox will autosize to accommodate text occuping a larger or smaller space than specified.
fontSize The size of the font.
bold Pass in a 1 to bold the text.
color Set the color of the text.

Description

Asserts a title text box if the slide layout includes or included one.


			  PowerPoint.Presentation presentation = PowerPoint.Presentation.create(1);
			  presentation.addSlide(PowerPoint.Layout.title);
			  presentation.slides[1].assertTitleBox("New Text", Vec2(80, 80), Vec2(200, 50), 30, 0, Color.blue);
			
Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.delete()

void delete( )

Description

Deletes the slide.


			  PowerPoint.Presentation presentation;
			  presentation.open(modeldir() + "\\Presentation.pptx", 1);
			  presentation.slides[1].delete();
			
Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.duplicate()

PowerPoint.Slide duplicate( )

Description

duplicates the slide.


			  PowerPoint.Presentation presentation = PowerPoint.Presentation.open(modeldir() + "\\Presentation.pptx", 1);
			  presentation.slides[1].duplicate();
			
Do no remove, this fixes the anchor on doc.flexsim.com

PowerPoint.Slide.setBackgroundColor()

void setBackgroundColor( Color color )

Parameters

color The color you are setting the background color to.

Description

Sets the slide's background color.


			  PowerPoint.Presentation presentation = PowerPoint.Presentation.create(1);
			  presentation.addSlide(PowerPoint.Layout.blank);
			  presentation.slides[1].setBackgroundColor(Color(1, 0, 0, .5)); //Sets the background color of the slide to Salmon.