跳到主要内容

Fill

Sets the fill formatting properties to the current graphic object.

Syntax

expression.Fill(oFill);

expression - A variable that represents a ApiDrawing class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oFillRequiredApiFillThe fill type used to fill the graphic object.

Returns

boolean

Example

This example sets the fill formatting properties to the current graphic object.

// How to color a drawing with a radiant fill.

// Change the background color of the shape.

let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.CreateRGBColor(51, 51, 51));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let drawing = worksheet.AddShape("cube", 90 * 36000, 27 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
let gs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 213, 191), 0);
let gs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 111, 61), 100000);
fill = Api.CreateRadialGradientFill([gs1, gs2]);
drawing.Fill(fill);