clone method

clone()

Performs a deep copy of the Document.

clone()

Returns

The cloned document.

Examples

Shows how to deep clone a document.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);
builder.write("Hello world!");
// Cloning will produce a new document with the same contents as the original,
// but with a unique copy of each of the original document's nodes.
let clone = doc.clone();
expect(doc.firstSection.body.firstParagraph.runs.at(0).getText()).toEqual(
    clone.firstSection.body.firstParagraph.runs.at(0).text);

See Also