跳到主要内容

SetStrikeout

Specifies that the contents of this paragraph are displayed with a single horizontal line through the center of the line.

Syntax

expression.SetStrikeout(isStrikeout);

expression - A variable that represents a ApiParagraph class.

Parameters

NameRequired/OptionalData typeDefaultDescription
isStrikeoutRequiredbooleanSpecifies that the contents of the current paragraph are displayed struck through.

Returns

ApiParagraph

Example

This example applies strikeout formatting to paragraph text.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
slide.RemoveAllObjects();

const fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape('rect', Api.MillimetersToEmus(300), Api.MillimetersToEmus(130), fill, stroke);
shape.SetPosition(Api.MillimetersToEmus(20), Api.MillimetersToEmus(35));
const docContent = shape.GetContent();
const paragraph = docContent.GetElement(0);
paragraph.AddText('This is a paragraph with the text struck out with a single line.');
paragraph.SetStrikeout(true);
slide.AddObject(shape);