For cell Selection is work (but can't keep the style setting after break the link), but I also want to break the table style, but error
For both Break link to cell/table style, I want to keep the style setting after break the link
BreakLinkToTableStyleSelection();
BreakLinkToCellStyleSelection();
function BreakLinkToTableStyleSelection () {
var
mNone = app.activeDocument.tableStyles.item(0),
mSel = app.selection[0];
if(mSel.constructor.name === "Cell" || mSel.constructor.name === "Table") {
mSel.tables.everyItem().appliedTableStyle = mNone;
return;
};
if(mSel.hasOwnProperty("baselineShift")){
mSel.tables.everyItem().appliedTableStyle = mNone;
return;
};
};
function BreakLinkToCellStyleSelection () {
var
mNone = app.activeDocument.cellStyles.item(0),
mSel = app.selection[0];
if(mSel.constructor.name === "Cell" || mSel.constructor.name === "Table") {
mSel.cells.everyItem().appliedCellStyle = mNone;
return;
};
if(mSel.hasOwnProperty("baselineShift")){
mSel.tables.everyItem().cells.everyItem().appliedCellStyle = mNone;
return;
};
};