🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19269

Problem with TextContents property

#19269
From: Chris Nicotra
Date: Tue, 31 Dec 2002 16:07
29 lines
1951 bytes
Having a problem with the TextFrame TextContents property. I have a collection of names that do not have photos and I just want to add them to the text frame.

With the following code:

txtFrame.TextContents = "Photos Not Available: ";

textLines = (InDesign.TextLines) txtFrame.TextLines;

textLine = (InDesign.TextLine) textLines.Item(1);
textLine.ApplyStyle(ps, false);
textLine.Justification =InDesign.idJustification.idRight;

foreach (string s in noPhotos)
{
    txtFrame.TextContents += "\n" + s;

textLines = (InDesign.TextLines) txtFrame.TextLines;
    textLine = (InDesign.TextLine)
    textLines.Item(textLines.Count);
    textLine.ApplyStyle(ps, false);
    textLine.Justification = InDesign.idJustification.idRight;
}

I end up with one of the names before the "Photos Not Available" string, some odd numbers in the string, and on the first or second time around the foreach loop, the textLines.Count becomes 0.

I got a work around working where I just build the string once and assign it to TextContents, but since this is exactly the same as other code I use earlier in the program, I'd like to understand what the problem might be.

Thanks,
/Chris
Technical Details
Message-ID: <1de72f24.-1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,833b34ad00319d78,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-12-31 08:38:05 PST
From: "Chris Nicotra" <cgn1234@yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Problem with TextContents property
Message-ID: <1de72f24.-1@WebX.la2eafNXanI>
Date: Tue, 31 Dec 2002 08:07:34 -0800
Lines: 36
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit