Article View: adobe.scripting.indesign
Article #15670Re: Moving formatted text
From: Dave_Saunders
Date: Thu, 20 Nov 2003 13:26
Date: Thu, 20 Nov 2003 13:26
18 lines
2058 bytes
2058 bytes
OK, success. This script moved a seven paragraph story into the diagonal cells of a seven by seven table:
myStory = app.selection[0].parentStory;
myLim = myStory.paragraphs.length;
myTargStory = app.documents[0].textFrames.item('Target').parentStory;
myTargTable = myTargStory.textFrames[0].tables[0];
for (i=(myLim-1); i>-1; i--) {
myStory.paragraphs.item(i).move(LocationOptions.atEnd, myTargTable.rows.item(i).cells.item(i).texts.item(i));
}
But it really is a move. I guess I'm going to have to duplicate each text frame, move its contents, and then delete the dupe, otherwise rerunning the script over the same document will be impossible.
At first, of course, I forgot to iterate backwards through the paragraphs, because they disappear when moved. I can see that being an issue. I may have to dupe the frame for each paragraph, move the part of the paragraph I need and then delete the dupe. That way, the original story is preserved should I need to start the script over for whatever reason, and I can just iterate through the paragraphs in any frame without having to worry about paragraphs disappearing.
This is important because I may have to add columns to this table as I go, and I need to add them while working left to right (I guess I could do it backwards, but I'm carrying in my head a model of how this thing should work, and every little change makes my ability to remember more tenuous).
Dave
Technical Details
Message-ID:
<2cce7d8f.7@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2cce7d8f.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,2aa45b5334d34582 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-11-20 05:37:53 PST From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: Moving formatted text Message-ID: <2cce7d8f.7@webx.la2eafNXanI> Date: Thu, 20 Nov 2003 05:26:33 -0800 References: <2cce7d8f.-1@webx.la2eafNXanI> Lines: 32 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit