1.using Document Server
2.the version is 8.2.2 (build:22)
As shown in the figure, when using “oDocument. SearchAndReplace”, what is in the replaceString parameter “\r\n” Or “\n” After replacement, it will be displayed as a space and cannot be wrapped
Hello @zazatyty
To insert a line break you should use \v
or ^l
like that:
var oDocument = Api.GetDocument();
oDocument .SearchAndReplace({ "searchString": "Replace", "replaceString": "Foo\vfoo" });
Some more tools:
\t
or ^t
to insert a tabulation;
\f
or ^m
to insert a page break;
\x0e
or ^n
to insert a column break;
\x1e
or ^~
to insert a non-breaking hyphen.
Answering a question “Why it differs?”:
The backslash (\
) is an escape character in JavaScript. This means that when JavaScript encounters a backslash, it tries to escape the following character. For instance, \n
is a newline character (rather than a backslash followed by the letter n).