Copy link to clipboard
Copied
Hi there!
If nothing is selected in a document, the user can still choose defaults in all styles panels (character, paragraph, object, table, cell styles). With
app.activeDocument.textDefaults.[...]
app.activeDocument.pageItemDefaults.[...]
I can change those defaults as I like. But I haven't found a setting to change table and cell style defaults.
So my question is:
Is it somehow possible to reset table and cell style defaults as it is with paragraph, character, and object style defaults with a script?
Thanks,
Tobias
> What is the corresponding code for table and cell styles?
As far as I can tell it's not possible to set default table and/or cell styles in the way you can for the other styles. Rob's suggestion is a workaround for this absent feature..
Copy link to clipboard
Copied
Hi Tobias, Are you creating the table via a script? If that’s the case maybe set the default style in the add method’s properties parameter—here my "default" style is named MyDefault
var ip = app.activeDocument.selection[0].insertionPoints[0];
var dt = app.activeDocument.tableStyles.itemByName("MyDefault")
var t = app.documents[0].stories[0].tables.add(LocationOptions.AT_BEGINNING, ip, {appliedTableStyle:dt})
Before run:
After
Copy link to clipboard
Copied
Thanks Rob for your input, but I meant something else:
The user can select a table (and cell) style without selecting any object in the document – so before running the script there is a selected table and/or cell style:
And I want to change this user default to table and cell style "[None]" – so after running the script no table and cell style is selected:
So I’m looking for something to reset user selection (without any selected object in a document) of table and cell style which is similar to resetting user selection (without any selected object in a document) of character and paragraph styles:
var aDoc = app.activeDocument;
aDoc.textDefaults.appliedCharacterStyle = aDoc.characterStyles.item(0);
aDoc.textDefaults.appliedParagraphStyle = aDoc.paragraphStyles.item(0);What is the corresponding code for table and cell styles?
Thanks, Tobias.
Copy link to clipboard
Copied
> What is the corresponding code for table and cell styles?
As far as I can tell it's not possible to set default table and/or cell styles in the way you can for the other styles. Rob's suggestion is a workaround for this absent feature..
Copy link to clipboard
Copied
Thank you for your clarification, Peter! And Rob for the workaround for some use cases.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more