Programmer's Guide > Programming and Scripting Techniques > Working with Tables > Example: Identifying a Document Type's Table Model Support
  
Example: Identifying a Document Type's Table Model Support
This example uses the function tableModelInfo to print all the available information on the current document type's supported table model(s) to the Arbortext Editor message window.
To run this sample code:
1. Copy the tableModelInfo code to a file named tableinfo.js in Arbortext-path\custom\scripts.
2. Start Arbortext Editor, open a Arbortext XML Docbook or an XHTML v1.0 template, and enter the following commands at the Arbortext Editor command line:
source tableinfo.js
js tableModelInfo

//-----------------------------------------------------------------
// Function: tableModelInfo
// Description: Print all information about the current table models
// Parameters: NONE
//-----------------------------------------------------------------
function tableModelInfo()
{
var docType = Application.activeDocument.doctype;
var tblModels = docType.tableModels;
Application.alert("Table model information for the " +
docType + "doctype");
Application.alert("Number of table models = " + tblModels.length);
for (var i = 0; i < tblModels.length; i++) {
Application.print(" [" + i + "] = '" + tblModels.item(i) + "'");
Application.print(" Supports multiple grids = " +
docType.tableModelSupport(tblModels.item(i), "multiplegrids"));
Application.print(" Supports headers = " +
docType.tableModelSupport(tblModels.item(i), "HeaderRows"));
Application.print(" Supports footers = " +
docType.tableModelSupport(tblModels.item(i), "FooterRows"));
var wrappers = docType.tableModelWrappers(tblModels.item(i));
Application.print(" Number of wrapper tags = " + wrappers.length);
for (var j = 0; j < wrappers.length; j++) {
Application.print(" [" + j + "] = '" + wrappers.item(j) + "'");
}
var tags = docType.tableModelTags(tblModels.item(i));
Application.print(" Number of table model tags = " + tags.length);
for (j = 0; j < tags.length; j++) {
Application.print(" [" + j + "] = '" + tags.item(j) + "'");
}
}
}//end of tableModelInfo