Can you tell me the table style, cell object style their names.
You can search the entire scripting API. Here are the ExtendScript document methods and objects:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html
To find proberties there is the document’s cellStyle, tableStyle, paragraphStyle, characterStyle, ObjectStyle.
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#CellStyle.html#d1e456077
Note for creating a new style you use the plural (i.e., d.cellStyles.add())
Here is a makeCellStyle function:
var cs = makeCellStyle(app.activeDocument, "My Cell Style");
//set the properties of the style named cs
cs.properties = {fillColor:"Black"};
/**
* Makes a new named Cell Style or get the style named n
* @ param the document to add the style to
* @ param style name
* @ returns the new cell style
*/
function makeCellStyle(d, n){
var cs;
try {
d.cellStyles.add({name:n});
}catch(e) {
cs = d.cellStyles.itemByName(n);
}
return d.cellStyles.itemByName(n);
}
You can also have a universal function by referencing the document's relevant property via a string reference:
var makeStyle = function(doc, styleName, collection) {
doc[collection].add....
}
makeStyle(app.activeDocument, "pa", "paragraphStyles");