Skip to main content
SangeethaRajeshkumar
Inspiring
August 24, 2018
Answered

Move answer text to answer layer

  • August 24, 2018
  • 1 reply
  • 602 views

Hi

I want to create textframe for answer text in question layer and then move the textframe to anno layer, but keep the anchor in question layer.

I have created the textframe, but when i move the textframe to anno layer i am getting the below error.

Here is the code

var myDoc = app.activeDocument;

app.findGrepPreferences = null;

app.findGrepPreferences.appliedCharacterStyle = myDoc.characterStyles.item("Anno"); 

var AnnoList = myDoc.findGrep();

for (i=0; i<AnnoList.length; i++)

{

TextFr = AnnoList.textFrames.add({anchoredObjectSettings:{anchoredPosition:AnchorPosition.INLINE_POSITION, anchorXoffset:"1mm"}});

TextFr.geometricBounds = ["0mm", "0mm","5mm", "30mm" ];

AnnoList.move(LocationOptions.AT_BEGINNING, TextFr.texts[0]);

TextFr.fit (FitOptions.FRAME_TO_CONTENT);

L = app.activeDocument.layers.item ('AnnoLayer');

TextFr.itemLayer = L;

}

Regards,

Sangeetha

This topic has been closed for replies.
Correct answer Laubender

Hi Sangeetha,

if the item is grouped or anchored to a text frame it cannot be moved to a different layer.

So first test if the item is grouped or anchored, then you could:

1. Duplicate the item and move it to a different layer

2. Remove the original from the group or the text frame.

Regards,
Uwe

1 reply

LaubenderCommunity ExpertCorrect answer
Community Expert
August 24, 2018

Hi Sangeetha,

if the item is grouped or anchored to a text frame it cannot be moved to a different layer.

So first test if the item is grouped or anchored, then you could:

1. Duplicate the item and move it to a different layer

2. Remove the original from the group or the text frame.

Regards,
Uwe

Community Expert
August 24, 2018

FWIW: The same goes for an item that is pasted inside a graphic frame or added to a graphic frame with method add().

To move something to a different layer requires that its parent is object Spread.

Regards,
Uwe