Copy link to clipboard
Copied
Looking for a way to change the table format (drop down list in the Table Designer) via scripting. Does anyone know what the Fcode for some 'Apply Table Format' command is? I have no idea what the command would be called like, so GetNamedCommand will not help me here. Should I use SetProps on the TblFormat instead? Has anyone done this before?
Hi Jang,
here's a code snippet from Bharat Prakash
...function changeTblTag(active)
{
if(active.BookIsSelected || active.FirstSelectedComponentInBook)
iterateBook(active);
else if(active.ObjectValid())
{
var flow = active.FirstFlowInDoc;
while(flow.ObjectValid())
{
var i = 0;
var textItems = flow.GetText(Constants.FTI_TblAnchor) // Get all tabl
Copy link to clipboard
Copied
Hi Jang,
here's a code snippet from Bharat Prakash
function changeTblTag(active)
{
if(active.BookIsSelected || active.FirstSelectedComponentInBook)
iterateBook(active);
else if(active.ObjectValid())
{
var flow = active.FirstFlowInDoc;
while(flow.ObjectValid())
{
var i = 0;
var textItems = flow.GetText(Constants.FTI_TblAnchor) // Get all tables in the flow
var newtblfmt = active.GetNamedTblFmt(finalTag)
while(i<textItems.length)
{
if(isTableInReferenceOrHiddenPageOrMasterPage(textItems.obj.TextLoc))
i++
else
{
var currtblfmttag = textItems.obj.TblTag
if(currtblfmttag == iniTag)
{
textItems.obj.SetProps (newtblfmt.GetProps())
tblCount++
}
i++
}
if(i == textItems.length)
break;
}
flow = flow.NextFlowInDoc
}
// savedoc(active);
}
if(DeleteFormat)
iniTag.Delete()
}
Copy link to clipboard
Copied
Hello Klaus,
Thanks for digging this up. It is a lot of code I don't need, but the one vital line solved my problem. Getting the properties of the named table format and applying all those properties to the table object makes sense. And it works.
Ciao