Copy link to clipboard
Copied
I tried but there is only way to clearCellOverrides but I don't see any method to point CellOverrides. Help me with this point!
var tables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
for (var j = 0; j < tables.length; j++) {
var cells = tables[j].cells.everyItem().getElements();
for (var k = 0; k < cells.length; k++) {
cells[k].select();
var clearOverridesCmd = app.menuActions.itemByID(132128);
if (clearOverridesCmd.enabled) {
var OverCellObject = {
cellContent: cells[k].contents,
...
Copy link to clipboard
Copied
is there anyway to indicate cellOverrides is present in document??
Copy link to clipboard
Copied
--
Copy link to clipboard
Copied
This script alerts you when there are overset cells in a document:
if (app.documents[0].stories.everyItem()
.tables.everyItem()
.cells.everyItem()
.overflows.join('').indexOf('true') >= 0) {
alert ('There are overset cells in the document.');
}
I know what your next question will be.
Copy link to clipboard
Copied
Hi Peter,
The OP asked for cellstyle override you alerted overset. So as you mentioned you already know the question, please be kind enough to explain it 🙂
-Manan
Copy link to clipboard
Copied
Aha -- thanks, @Manan Joshi I misread that. Well, finding (cell) style overrides isn't so easy. Text-style overrides can be displayed, but to collect cells with overridden style isn't so easy.
Instead of checking whether there are style overrides, maybe clear all overrides. Is that a possibility?
P.
Copy link to clipboard
Copied
Thanks for confirming @Peter Kahrel, to be honest I was expecting that you would pull out a rabbit from your hat and I would be amazed as always. With this cleared out we need to see what the OP is after, only that would tell us if clearing the overrides would work or not. Another trick that I used in the past for paragraph/character styles is to export the tagged text and then parse it to find the properties that had the overrides applied over it. Not sure if it would work with cell styles, probably not but that remains to be seen.
-Manan
Copy link to clipboard
Copied
var tables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
for (var j = 0; j < tables.length; j++) {
var cells = tables[j].cells.everyItem().getElements();
for (var k = 0; k < cells.length; k++) {
cells[k].select();
var clearOverridesCmd = app.menuActions.itemByID(132128);
if (clearOverridesCmd.enabled) {
var OverCellObject = {
cellContent: cells[k].contents,
CellpageNo: cells[k].parent.parent.parentPage.name,
cellStyleName: cells[k].appliedCellStyle.name
};
myCellOverrides.push(OverCellObject);
}
}
}
I tried like this and it was working fine for me! Thanks for your response and efforts @Peter Kahrel and @Manan Joshi
Copy link to clipboard
Copied
Very clever, @Karthik SG .
Copy link to clipboard
Copied
Thanks @Peter Kahrel