🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16232

Re: [VB]Placing text in frame, with different styles

#16232
From: Iolaire_McFadden
Date: Fri, 03 Oct 2003 14:16
17 lines
2016 bytes
Is this more along the lines of what you want?
1. Get ready to place text at the end of myTextFrame
--- This code is simplifying things it only works if the text to add will be the last item in the frame, I don't know how to indicate that it should go after Paragraph 1 unless something like this (Set MyInsertionpoint = myTextFrame.Paragraphs.Item(2)) works. So you want to set your insertion point to the last item in the frame the item(-1) :
Set MyInsertionpoint = myTextFrame.InsertionPoints.Item(-1)

2. But before you place it you need to set that the new text has a style, in this case I use a paragraph style named "Italics_Style", so you set the style of the insertion point (undoubtedly you could change this to character style:
myinsertionpoint.ApplyStyle myDocument.ParaStyles.Item("Italics_Style")

3. then place the text:
myinsertionpoint.TextContents = "Your String"

Final code:
Set MyInsertionpoint = myTextFrame.InsertionPoints.Item(-1)
myinsertionpoint.ApplyStyle myDocument.ParaStyles.Item("Italics_Style")
myinsertionpoint.TextContents = "Your String"

(There are some long discussions about how to search for specific text in the Archive that might help if the location of the text to place moves around)
Technical Details
Message-ID: <2ccd9e01.2@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccd9e01.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,2da61a4116613d05
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-10-03 07:37:46 PST
From: Iolaire_McFadden@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: [VB]Placing text in frame, with different styles
Message-ID: <2ccd9e01.2@webx.la2eafNXanI>
Date: Fri, 3 Oct 2003 07:16:03 -0700
References: <2ccd9e01.-1@webx.la2eafNXanI>
Lines: 28
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit