Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

How to break link to cell/table style in a selection

$
0
0

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;
        }
    }


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>