Javascript: Table.setDescriptiveText Method
Description
Sets the table's descriptive text. The descriptive text is used by screen readers to describe the table to users with visual impairments. An empty string or null can be passed to remove the descriptive text.
Syntax
<void> Table.setDescriptiveText(<string> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| value | The new property value. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Table.setDescriptiveText in a practical document-editing workflow. It sets the table's descriptive text. The descriptive text is used by screen readers to describe the table to users with visual impairments. An empty string or null can be passed to remove the descriptive text.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const tables = mainText.tables;
tables.getItem(function(table) {
if (!table) {
console.warn("No table is available at the current input position.");
return;
}
table.setDescriptiveText(
"Quarterly report",
function() {
console.log("set descriptive text completed.");
},
onTxError
);
}, onTxError);
}, onTxError);