I can break link to cell/table style in a current document, but if I want to do it in a selection, it seem error, anyone would help me to fix it?
Script A (For Document is ok)
BreakLinkToCellStyleDocument();
function BreakLinkToCellStyleDocument(){
var myDoc = app.activeDocument;
myCells = myDoc.stories.everyItem().tables.everyItem().cells.everyItem().getEle ments();
for (var i=0; i<myCells.length; i++){
myCell = myCells[i];
myCell.appliedCellStyle = myDoc.cellStyles.item(0), false;
}
}
Script B (For Selection occur error)
BreakLinkToCellStyleSelection();
function BreakLinkToCellStyleSelection(){
var myDoc = app.selection[0];
myCells = myDoc.tables.everyItem().cells.everyItem().getElements();
for (var i=0; i<myCells.length; i++){
myCell = myCells[i];
myCell.appliedCellStyle = myDoc.cellStyles.item(0), false;
}
}