Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note: This feature requires PowerPointApplication

To programmatically set the alignment of the picture on the slide, use the Picture.Align method. Picture.Align takes an Alignment object as a parameter. The Alignment object can have the following values:

Name

Description

Anchor
Top
Top
Top

Aligns the picture at the top of the slide.

Anchor
Middle
Middle
Middle

Aligns the picture in the middle of the slide.

Anchor
Bottom
Bottom
Bottom

Aligns the picture on the bottom of the slide.

Anchor
Left
Left
Left

Aligns the picture on the left side of the slide.

Anchor
Center
Center
Center

Aligns the picture in the center of the slide.

Anchor
Right
Right
Right

Aligns the picture on the right side of the slide.

Sample code

Code Block
titleInserting an Image from a byte array C#
languagecsharp
//The ReadAllBytes method can be used to create a byte array from an image filepath.
byte[] imgArray = File.ReadAllBytes(@"C:\image.png");

//create an object array of values to be populated
object[] valuesArray = {imgArray};

//create a string array of column names.
//the field names must match the data marker column names in the template.
string[] colNamesArray = {"Logo(image(1,2,2))"};

//set the data source
pptt.BindData(valuesArray, colNamesArray, "Company",pptt.CreateDataBindingProperties());

pptt.Process();

...