Copy link to clipboard
Copied
Why if I get a story and try to
myStory.move(LocationOptions.AT_END , myIP);
Where myStory is all contents of a text frame and myIP is an insertion point in another story.
But when I try this, some paragraphs loose their formatting.
If I select the story, cut it, select the insertion point, and then paste, like this:
app.cut();
app.paste();
It works. Am I missing something?
What if I don't have the document visible?
Looked into your document.
What is the story you like to move?
Where is the insertion point?
With this example I can see your issue:
var mainStory = app.documents[0].textFrames[0].parentStory;
var storyToMove = mainStory.textFrames[0].parentStory;
var targetInsertionPoint = mainStory.textFrames[0].parent.insertionPoints[0];
storyToMove.move( LocationOptions.AT_END , targetInsertionPoint );
Before running the script:
After running the script the paragraph once starting with "e)" changed its
...Copy link to clipboard
Copied
I'm surprised anything at all happens: AT_ENT should be AT_END
But, seriously, maybe try .AFTER when you place relative to an insertion point.
Copy link to clipboard
Copied
Misstyped, Mr. Kahrel.
.AFTER do not work at all.
Just changes the unformatted paragraph from the first to the last one.
Copy link to clipboard
Copied
Hi lf.corullon,
can you make a sample document available for download where you see this behavior?
Just one page with two text frames not threaded.
Thanks,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Sure, Laubender.
Here is the idml file: https://drive.google.com/open?id=1xLd0jXr3muKd_FWsCjBKcdS9to57LZ5O
Copy link to clipboard
Copied
Looked into your document.
What is the story you like to move?
Where is the insertion point?
With this example I can see your issue:
var mainStory = app.documents[0].textFrames[0].parentStory;
var storyToMove = mainStory.textFrames[0].parentStory;
var targetInsertionPoint = mainStory.textFrames[0].parent.insertionPoints[0];
storyToMove.move( LocationOptions.AT_END , targetInsertionPoint );
Before running the script:
After running the script the paragraph once starting with "e)" changed its formatting:
The reason is clear. You need a paragraph return at the end of the story you like to move.
Otherwise InDesign picks up the formatting from the recieving text.
Now when a paragraph return is added:
The script works as expected:
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Perfect, Uwe! Thank you so much.
I can't understand the behavior, but OK. If it works this way, it works this way.
Thank you for the clear explanation, as always!