Skip to main content

Copy

Creates a copy of the current run.

Syntax

expression.Copy();

expression - A variable that represents a ApiRun class.

Parameters

This method doesn't have any parameters.

Returns

ApiRun

Example

Duplicate a text run and place the copy into the same paragraph in a document.

// How do I reproduce an existing text run and insert it again in a document?

// Clone a run so the same styled text appears twice within a paragraph in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let run1 = Api.CreateRun();
run1.AddText("This is just a sample text that was copied. ");
paragraph.AddElement(run1);
let run2 = run1.Copy();
paragraph.AddElement(run2);