Skip to main content

Search Specified Content in Document

Code Examples

Example 1: Search and highlight text

async function example1() {
const success = await app.ActiveDocument.Content.Find.execute('zOffice');
console.log('success:', success);
}

Example 2: Find count of content "zOffice" in full text, whole word match

async function example2() {
const count = await app.ActiveDocument.Content.Find.findData(
"zOffice",
false,
true
);
}

Example 3: Find count of content "zOffice" in current selection, whole word match

async function example3() {
const range = await app.ActiveDocument.getSelection();
const count = await range.Find.findData("zOffice", false, true);
}

Example 4: Find count of content "zOffice" in specified bookmark, whole word match

async function example4() {
const bm = await app.ActiveDocument.Bookmarks.item('bm1');
const range = await bm.range;
const count = await range.Find.findData("zOffice", false, true);
}