Article View: adobe.scripting.indesign
Article #18351Re: place text in master frame and autoflow [AS]
From: Olav Kvern
Date: Wed, 02 Apr 2003 00:45
Date: Wed, 02 Apr 2003 00:45
59 lines
2977 bytes
2977 bytes
Ray--
If you tell a TextFrame to place a text file with autoflow on, the text file gets placed outside the text frame--it'll create new frames that fill the area inside the margins (i.e., the page "live area"). So you might as well use the Place method on the Page object. If, on the other hand, you tell a text stream object (Character, Word, InsertionPoint, etc.) to place with autoflow, the autoflow parameter is ignored (same as in the UI).
So to get the text into a specific part of a page, you'll need to adjust the margins to change the live area of the page before you place the file. As far as I can tell.
But you've also run into a bug in the Place method--the autoflow and importOptions parameters seem to be mixed up. The Place method template says:
Place(FileName, [placePoint], [Layer], [autoFlow As Boolean], [importOptions As Boolean],...
But it's really:
Place(FileName, [placePoint], [Layer], [importOptions As Boolean], [autoFlow As Boolean],...
So what you want is something like this:
Dim myInDesign As InDesign.Application
Dim myPage As InDesign.Page
Set myInDesign = CreateObject("InDesign.Application.2.0")
myInDesign.UserInteractionLevel = idDontDisplayAlerts
Set myDocument = myInDesign.Documents.Add
Set myPage = myDocument.Pages.Item(1)
Rem Find the upper-left corner of the live area of the page.
myX = myPage.MarginPreferences.MarginLeft + 1
myY = myPage.MarginPreferences.MarginTop + 1
Rem You'll have to fill in your own file name.
myPage.Place "c:\mySampleText.txt", Array(myX, myY), , False, True, True, True
myInDesign.UserInteractionLevel = idDisplayAlerts
re: losing styles
That's because you've turned off the retainFormat option. Given our above correction, the Place method template looks like this:
Place(FileName, [placePoint], [Layer], [importOptions As Boolean], [autoFlow As Boolean], [retainFormat As Boolean], [convertQuotes As Boolean])
In your example, you set retainFormat to 0, or False. Try setting it to True, and you should get your styles. If not, then there's something wrong with your tagged text file.
Thanks,
Ole
Technical Details
Message-ID:
<1de86ee4.2@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!transit.news.xs4all.nl!bnewspeer00.bru.ops.eu.uu.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de86ee4.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,e6b6a41ddbdb1c21 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-04-01 17:07:41 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!transit.news.xs4all.nl!bnewspeer00.bru.ops.eu.uu.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: place text in master frame and autoflow [AS] Message-ID: <1de86ee4.2@WebX.la2eafNXanI> Date: Tue, 1 Apr 2003 16:45:00 -0800 References: <1de86ee4.-1@WebX.la2eafNXanI> Lines: 61 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit