Skip to main content

GetDashType

Gets the dash type of the stroke.

Syntax

expression.GetDashType();

expression - A variable that represents a ApiStroke class.

Parameters

This method doesn't have any parameters.

Returns

DashType | null

Example

Determine the line pattern of a border in a presentation.

// How do I find out if a border line is solid or dashed in a presentation?

// Retrieve the line pattern style from a stroke and check its settings in a presentation.

let presentation = Api.GetPresentation();
let slide = presentation.GetSlideByIndex(0);
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 200, 100));
let stroke = Api.CreateStroke(36000, Api.CreateSolidFill(Api.CreateRGBColor(0, 0, 255)));
let shape = Api.CreateShape("rect", 100 * 36000, 50 * 36000, fill, stroke);
shape.SetPosition(2000000, 1000000);
slide.AddObject(shape);
let content = shape.GetDocContent();
let paragraph = content.GetElement(0);
let retrievedStroke = shape.GetLine();
let dashType = retrievedStroke.GetDashType();
paragraph.AddText("Dash type: " + (dashType ? dashType : "not set"));