CreateRun
Creates a new smaller text block to be inserted to the current paragraph or table.
Syntax
expression.CreateRun();
expression - A variable that represents a Api class.
Parameters
This method doesn't have any parameters.
Returns
Example
Add independently styled text segments to a paragraph inside a shape in a spreadsheet.
// How do I insert multiple text pieces with different formatting into one paragraph in a spreadsheet?
// Build a paragraph from separate text portions so each portion can carry its own style in a spreadsheet.
let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = worksheet.AddShape("flowChartOnlineStorage", 120 * 36000, 70 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
let docContent = shape.GetContent();
let paragraph = docContent.GetElement(0);
let run = Api.CreateRun();
run.AddText("This is just a sample text. ");
paragraph.AddElement(run);
run = Api.CreateRun();
run.SetFontFamily("Comic Sans MS");
run.AddText("This is a text run with the font family set to 'Comic Sans MS'.");
paragraph.AddElement(run);