0

I am trying to change the default document settings for a batch of InDesign documents – that is, the styles, swatches etc. that are 'active' (marked blue) in an open document with nothing selected.

But I have a hard time figuring out how to change the default cell style.

Stroke swatch, Paragraph style and Character style are simple:

app.activeDocument.pageItemDefaults.strokeColor = "Black";

app.activeDocument.textDefaults.appliedParagraphStyle = app.activeDocument.paragraphStyles.item ("[Basic Paragraph]");

app.activeDocument.textDefaults.appliedCharacterStyle = app.activeDocument.characterStyles.item ("[None]");

Cell style, however, is not so easily accessed, even though it is really just a simple mouse-click for a user. There is no 'appliedCellStyle' property.

How can I do this?

UncleToft
  • 38
  • 9
  • Are you sure selecting a Cell Style, with nothing selected, behaves like the other text elements? I just tried: created a new Cell Style, clicked it, then created a table. It gets the default *table* style but the cell styles are unaffected. – Jongware Jan 10 '14 at 00:19
  • Yes, but if you select that cell style, then save the document, close it and reopen it, that cell style will be selected still. – UncleToft Jan 10 '14 at 18:40

1 Answers1

0

I think defalut cell style is "None", though selected other cell style in GUI if you want apply default cell style as "None", there are no need to do. when create a table without applying table style, the cells are always applyied 'None'.

please try this code.

var table = app.activeDocument.textFrames.add().tables.add();
alert(table.cells.firstItem().appliedCellStyle.name);

thank you mg

milligramme
  • 404
  • 3
  • 9
  • Thanks, mg, but I am talking about the default 'selected' style when you open a document and have no elements selected. If you open a document, click a cell style and then save the document, the selected style will be saved as well. It is this default 'selection' that I want to access, not the applied style of any actual table element. – UncleToft Jan 08 '14 at 13:05
  • I wanted to say selected cell style is not effective like paragraph/character style. – milligramme Jan 09 '14 at 06:02
  • however, this's unpleasant ux. I also tried to click with cliclick(http://www.bluem.net/de/mac/cliclick/) and doScript() cell sytle panel, but no way to get the position of cell style item. – milligramme Jan 09 '14 at 06:18