Copy link to clipboard
Copied
I have a 2 documents, I want to copy the fully formatted content from one textframe on to another textframe in another document.
I have both textframe objects.
I have tried creating a temp textframe and moving it but the frames in question have XML Tags attached, which get coppied in the document when the temp frame is created.
any thoughts?
cheers
jsx
Hi D Jon Simcox
Why don't you use
parentSourceStory.duplicate(LocationOptions.after, destTextFrame[0].insertionPoints[0] );
Without using "paragraphs.everyItem()" ?
Don't see that its needed.
Copy link to clipboard
Copied
If you want to copy text contents, you don't have to mess around with its containing frame. Use myTextFrame.texts[0] and the Text Duplicate or Move method (http://jongware.mit.edu/idcsjs5.5/pc_Text.html).
Don't worry about the plural and index number of "texts[0]" -- I believe this is more of a side-effect of the programming model (and it has been left that way to prevent having to code multiple workarounds for such a minor issue), rather than that anticipating that somewhere in the future it's going to be possible to have "more than one Text" per frame.
Copy link to clipboard
Copied
Just to expand on Jongwares answer with a of practical example.
To copy selected text of to a different text frame or to copy entire contents of the text frame were the cursor is see bellow script.
Look at the reference that Jongware provided for other location options
myDoc = app.activeDocument;
myText=app.selection[0]; // Copies selected text DELETE THE LINE BELOW IF YOU WANT TO DO THIS!!
myText=app.selection[0].parentTextFrames[0].texts[0]; // Copies entire text frame contents.
myPage = myDoc.pages.add();
myTextFrame = myPage.textFrames.add();
myTextFrame.geometricBounds = [8, 8, 800, 200];
// Copies to new text frame (to move to new text frame use the move instead of duplicated i.e. myText.move(LocationOptions.AFTER,myTextFrame.insertionPoints[0]) ;
myCopy =myText.duplicate(LocationOptions.AFTER,myTextFrame.insertionPoints[0]) ;
Copy link to clipboard
Copied
past ? : end of last page & end of a paragraph
Copy link to clipboard
Copied
If you have an old version of indesign (no idea which) you might have to go with this approach.
Copy link to clipboard
Copied
Hi Both,
Thanks for the input. I ended up traversing up to the top parentStory and then copying the paragraphs, as the other methods did not seem to work to well with linked text boxes.
here is what I have - which seems to work for me.
Assuming sourceTextFrame and destTextFrame are the textFrames you want to copy the content from......
var theSourceFrame = sourceTextFrame[0];
var parentSourceStory = sourceTextFrame[0].parentStory;
parentSourceStory.paragraphs.everyItem().duplicate(LocationOptions.after, destTextFrame[0].insertionPoints[0] );
thanks again
Copy link to clipboard
Copied
Hi D Jon Simcox
Why don't you use
parentSourceStory.duplicate(LocationOptions.after, destTextFrame[0].insertionPoints[0] );
Without using "paragraphs.everyItem()" ?
Don't see that its needed.
Copy link to clipboard
Copied
Trevor,
you are absolutely right - thanks
Find more inspiration, events, and resources on the new Adobe Community
Explore Now