Skip to main content
Inspiring
October 8, 2024
Question

Error When Moving Paragraph Styles from Group Folder in InDesign CC 2024

  • October 8, 2024
  • 10 replies
  • 692 views

Hi,

I am using the below code for move styles from folder but its not working (CC2024).

var doc=app.activeDocument;
var pStyles=doc.paragraphStyles;
var pGroups=doc.paragraphStyleGroups;
for (i=pGroups.length-1; i>=0; i--){
var pStylesInGroup=pGroups[i].paragraphStyles;
for (j=pStylesInGroup.length-1; j>=0; j--){
pStylesInGroup[j].move(LocationOptions.AFTER, doc.allParagraphStyles[1]);
}
}

 

Getting below Error:

Error: Invalid value for parameter 'reference' of method 'move'. Expected ParagraphStyle, ParagraphStyleGroup, CharacterStyle, CharacterStyleGroup, CellStyle, CellStyleGroup, TableStyle, TableStyleGroup, Document or Application, but received ParagraphStyle.

 

 

<Title renamed by MOD>

This topic has been closed for replies.

10 replies

Robert at ID-Tasker
Legend
October 8, 2024

@$rikanth 

 

It kind of works - when you change indeks from "[1]" to "[3]"...

 

doc.allParagraphStyles[1]

 

doc.allParagraphStyles[3]

 

Robert at ID-Tasker
Legend
October 8, 2024

@$rikanth 

 

Can you post a screenshot of your ParaStyles panel?

 

$rikanthAuthor
Inspiring
October 8, 2024

 

$rikanthAuthor
Inspiring
October 8, 2024

Hi Robert

Now working fine thanks

m1b
Community Expert
Community Expert
October 8, 2024

Hi @$rikanth, are you trying to move all paragraph styles out of their groups (folders) and up to the top level of the document?

 

If so, change to:

pStylesInGroup[j].move(LocationOptions.AT_BEGINNING, doc);

- Mark 

$rikanthAuthor
Inspiring
October 8, 2024

Hi Mark,

Yes, but same issues.

 

pStylesInGroup[j].move(LocationOptions.AT_BEGINNING, doc);
Error: Invalid value for parameter 'reference' of method 'move'. Expected ParagraphStyle, ParagraphStyleGroup, CharacterStyle, CharacterStyleGroup, CellStyle, CellStyleGroup, TableStyle, TableStyleGroup, Document or Application, but received Document.

$rikanthAuthor
Inspiring
October 8, 2024

But can move group folder to group folder