PowerPoint.ShapeLineFormat class

Represents the line formatting for the shape object. For images and geometric shapes, line formatting represents the border of the shape.

Extends

Remarks

[ API set: PowerPointApi 1.4 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/get-shapes-by-type.yaml

// Changes the dash style of every line in the slide.
await PowerPoint.run(async (context) => {
  // Get the type of shape for every shape in the collection.
  const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
  shapes.load("type");
  await context.sync();

  // Change the dash style for shapes of the type `line`.
  shapes.items.forEach((shape) => {
    if (shape.type === PowerPoint.ShapeType.line) {
      shape.lineFormat.dashStyle = PowerPoint.ShapeLineDashStyle.dashDot;
    }
  });
  await context.sync();
});

Properties

color

Represents the line color in HTML color format, in the form #RRGGBB (e.g., "FFA500") or as a named HTML color (e.g., "orange").

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

dashStyle

Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details.

style

Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details.

transparency

Specifies the transparency percentage of the line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has inconsistent transparencies.

visible

Specifies if the line formatting of a shape element is visible. Returns null when the shape has inconsistent visibilities.

weight

Represents the weight of the line, in points. Returns null when the line is not visible or there are inconsistent line weights.

Methods

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original PowerPoint.ShapeLineFormat object is an API object, the toJSON method returns a plain JavaScript object (typed as PowerPoint.Interfaces.ShapeLineFormatData) that contains shallow copies of any loaded child properties from the original object.

Property Details

color

Represents the line color in HTML color format, in the form #RRGGBB (e.g., "FFA500") or as a named HTML color (e.g., "orange").

color: string;

Property Value

string

Remarks

[ API set: PowerPointApi 1.4 ]

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

context: RequestContext;

Property Value

dashStyle

Represents the dash style of the line. Returns null when the line is not visible or there are inconsistent dash styles. See PowerPoint.ShapeLineDashStyle for details.

dashStyle: PowerPoint.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot";

Property Value

PowerPoint.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"

Remarks

[ API set: PowerPointApi 1.4 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/get-shapes-by-type.yaml

// Changes the dash style of every line in the slide.
await PowerPoint.run(async (context) => {
  // Get the type of shape for every shape in the collection.
  const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
  shapes.load("type");
  await context.sync();

  // Change the dash style for shapes of the type `line`.
  shapes.items.forEach((shape) => {
    if (shape.type === PowerPoint.ShapeType.line) {
      shape.lineFormat.dashStyle = PowerPoint.ShapeLineDashStyle.dashDot;
    }
  });
  await context.sync();
});

style

Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See PowerPoint.ShapeLineStyle for details.

style: PowerPoint.ShapeLineStyle | "Single" | "ThickBetweenThin" | "ThickThin" | "ThinThick" | "ThinThin";

Property Value

PowerPoint.ShapeLineStyle | "Single" | "ThickBetweenThin" | "ThickThin" | "ThinThick" | "ThinThin"

Remarks

[ API set: PowerPointApi 1.4 ]

transparency

Specifies the transparency percentage of the line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has inconsistent transparencies.

transparency: number;

Property Value

number

Remarks

[ API set: PowerPointApi 1.4 ]

visible

Specifies if the line formatting of a shape element is visible. Returns null when the shape has inconsistent visibilities.

visible: boolean;

Property Value

boolean

Remarks

[ API set: PowerPointApi 1.4 ]

weight

Represents the weight of the line, in points. Returns null when the line is not visible or there are inconsistent line weights.

weight: number;

Property Value

number

Remarks

[ API set: PowerPointApi 1.4 ]

Method Details

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(options?: PowerPoint.Interfaces.ShapeLineFormatLoadOptions): PowerPoint.ShapeLineFormat;

Parameters

options
PowerPoint.Interfaces.ShapeLineFormatLoadOptions

Provides options for which properties of the object to load.

Returns

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames?: string | string[]): PowerPoint.ShapeLineFormat;

Parameters

propertyNames

string | string[]

A comma-delimited string or an array of strings that specify the properties to load.

Returns

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): PowerPoint.ShapeLineFormat;

Parameters

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.

Returns

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that is passed to it.) Whereas the original PowerPoint.ShapeLineFormat object is an API object, the toJSON method returns a plain JavaScript object (typed as PowerPoint.Interfaces.ShapeLineFormatData) that contains shallow copies of any loaded child properties from the original object.

toJSON(): PowerPoint.Interfaces.ShapeLineFormatData;

Returns