Copy link to clipboard
Copied
Is there a way to break links to style on multiple pages at a time? I have to move pages from other documents into a document and I don't want to bring the styles in with it.
Copy link to clipboard
Copied
If the text is threaded, of course, you can Select All and choose Break Links from the Para Styles menu. If the frames are not threaded, I think you'll have to select each frame. You can select multiple text frames and Break Links on all of them at once, provided they are not threaded to another page/spread.
The only other thing I can think of is to search out whether there's a script to automate further.
Copy link to clipboard
Copied
It's about Char/Para Styles - not links between TextFrames.
Copy link to clipboard
Copied
I see that Diane understood well what it was about, and gave correct instructions to break the links of ALL paragraphs to their respective styles in one or in multiple threaded text frames. Inasmuch, she exactly answered the question.
Copy link to clipboard
Copied
The script I posted will break the paragraph style link to all of the document’s text frame’s paragraphs. It will not get text in tables, but that could be added.
Copy link to clipboard
Copied
This should also break paragraph style links in table cells:
var d = app.activeDocument
var bls = app.menuActions.itemByID(8500);
var p = d.stories.everyItem().paragraphs.everyItem().getElements();
for (var i = 0; i < p.length; i++){
p[i].select()
if(bls.enabled){
bls.invoke();
};
};
var c = d.stories.everyItem().tables.everyItem().cells.everyItem().paragraphs.everyItem().getElements();
for (var i = 0; i < c.length; i++){
c[i].select()
if(bls.enabled){
bls.invoke();
};
};
Copy link to clipboard
Copied
But 8500 and 8501 can be executed on whole Stories AND whole Tables...
No need to iterate through paragraphs - in the Stories nor in the Cells.
Copy link to clipboard
Copied
That’s a good idea, but I think you have to select the texts of the stories:
var d = app.activeDocument
var bls = app.menuActions.itemByID(8500);
try {
var t = d.stories.everyItem().texts.everyItem().getElements();
for (var i = 0; i < t.length; i++){
t[i].select()
if(bls.enabled){
bls.invoke();
};
};
var c = d.stories.everyItem().tables.everyItem().cells.everyItem().texts.everyItem().getElements();
for (var i = 0; i < c.length; i++){
c[i].select()
if(bls.enabled){
bls.invoke();
};
};
}catch(e) {}
Copy link to clipboard
Copied
Yes, I know, you can't select Story - you have to select its Text.
But for Tables - you can select a whole Table - so there is no need to process each Cell individually.
Copy link to clipboard
Copied
If you'd like to do it really well, you'd need in fact to iterate through each cell, looking recursively at its content - since a cell can contain other tables or text frames containing tables and so on.
Moreover, it is explicitely not enough to select the table, hoping that cells are worked off automatically when invoking a table-related command.
Anyway - you'd really consider using the techniques explained below instead of invoking menu commands which should be the very last option to choose.
Just a simple thing: Have you tried invoking a menu command during this menu command has been taken out of the menus using "Edit > Menus"? Fingers crossed that it works.
Copy link to clipboard
Copied
All valid points...
But searching for "<0016>" will help to quickly find all Tables - instead of iterating through all Cells:
https://creativepro.com/use-findchange-to-find-tables/
Copy link to clipboard
Copied
Of course the correct structure of the nested Tables should be like this:
Copy link to clipboard
Copied
This is my version:
Copy link to clipboard
Copied
Hi @Veronica22551996i6fw , I don’t think there is a break link to style command in the scripting API, but you can select all the paragraphs and invoke the menu item via scripting, so you can try this:
var doc = app.activeDocument
var bls = app.menuActions.itemByID(8500)
for(var i=0; i < doc.stories.length; i++){
var s = doc.stories.item(i);
for(var j=0; j < s.paragraphs.length; j++){
var p=s.paragraphs[j];
p.select()
if(bls.enabled){
bls.invoke();
};
}
}
Copy link to clipboard
Copied
You are the life saviour! I've been lookind for this for literally years.
Since just assigning a key combination to this option gives ugly results.
Copy link to clipboard
Copied
In fact there is unfortunately no command like "...breakLinkToStyle(...)" or so. What you need to do is the following in order to break the link from ... :
table to table style:
table.appliedTableStyle = app.activeDocument.tablesStyles[0];
table.clearTableStyleOverrides();
cell to cell style: analogous, replacing "table" by "cell";
object to object style: analogous, replacing "table" by "object";
paragraph from paragraph style:
text..applyParagraphStyle(app.activeDocument.paragraphStyles[0], false);
character from character style: analoguous, replacing "Paragraph" by "Character".
Not kind of straighforward, but anyway, it works.
Copy link to clipboard
Copied
Sorry, obviously only one period character in
text.applyParagraphStyle(.....);