Get Started
Usage API
More information

ReplaceTextSmart

ReplaceTextSmart(arrString)

Replaces each paragraph(or text in cell) in the select with the corresponding text from an array of strings.

Parameters:

Name Type Description
arrString Array

represents an array of strings.

Returns:

This method doesn't return any data.

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oFParagraph = oDocument.GetElement(0);
oFParagraph.AddText("First paragraph");
oSParagraph = Api.CreateParagraph();
oSParagraph.AddText("Second Paragraph");
oDocument.Push(oSParagraph);
oRange1 = oFParagraph.GetRange();
oRange2 = oSParagraph.GetRange();
oRange3 = oRange1.ExpandTo(oRange2);
oRange3.Select();
arr = ["test_1", "test_2"];
Api.ReplaceTextSmart(arr);
builder.SaveFile("docx", "ReplaceTextSmart.docx");
builder.CloseFile();

Resulting document