Skip to main content

Get Content in Specified Area, Return HTML Format

Code Examples

Example 1: Get bookmark area content, return HTML format

async function example1() {
const bookmark = await app.ActiveDocument.Bookmarks.item(1);
const htmlString = await bookmark.getHtml();
}

Example 2: Get cell content, return HTML format

async function example2() {
const table = await app.ActiveDocument.Tables.item(1);
const row = await table.Rows.item(1);
const cell = await row.Cells.item(1);
const htmlString = await cell.getHtml();
}

Example 3: Get current selection content, return HTML format

async function example3() {
const range = await app.ActiveDocument.getSelection();
const html = await range.getHtml();
}