Skip to main content

Format Contract - Smart Bookmark

Function Description

Automatically identify and mark underlined areas in document as bookmarks, efficient and convenient.

Usage Instructions: Use documents with underlined content areas, call SDK API to automatically mark underlined areas as bookmarks.

Code Examples

Example 1: Identify underlined areas with text content as bookmarks, name bookmarks with content above underline

async function example1() {
const success = await app.ActiveDocument.Bookmarks.identify(
Word.MarksIdentifyRule.TEXT,
Word.MarksGenerateNameRule.ABOVE,
true
);
}

Example 2: Identify underlined areas with text content as bookmarks, name bookmarks with text content before underline

async function example2() {
const success = await app.ActiveDocument.Bookmarks.identify(
Word.MarksIdentifyRule.TEXT,
Word.MarksGenerateNameRule.BEFORE,
true
);
}

Example 3: Identify empty underlined areas as bookmarks, name bookmarks with text content before underline

async function example3() {
const success = await app.ActiveDocument.Bookmarks.identify(
Word.MarksIdentifyRule.EMPTY,
Word.MarksGenerateNameRule.BEFORE,
true
);
}