REPT

REPT(arg1, arg2) → { string }

Repeats text a given number of times. Use this function to fill a cell with a number of instances of a text string.

Parameters:

Name Type Description
arg1 string

The text that will be repeated.

arg2 number

A positive number specifying the number of times to repeat text.

Returns:

Type
string

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.REPT("Text", 3));
builder.SaveFile("xlsx", "REPT.xlsx");
builder.CloseFile();

Resulting document