Article View: adobe.scripting.indesign
Article #19090Re: XML caharcter attributes at beginning of a paragraph (VB)
From: Erwin Schwabe
Date: Thu, 16 Jan 2003 17:44
Date: Thu, 16 Jan 2003 17:44
37 lines
3147 bytes
3147 bytes
Sorry, the topic was truncated. This is the rest of the code.
Rem Add a text frame
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
Rem Size the text frame
Set myPage = myDocument.Pages.Item(1)
myX1 = myPage.MarginPreferences.MarginLeft
myY1 = myPage.MarginPreferences.MarginTop
myX2 = myDocument.DocumentPreferences.PageWidth - myPage.MarginPreferences.MarginRight
myY2 = myDocument.DocumentPreferences.PageHeight - myPage.MarginPreferences.MarginBottom
myTextFrame.GeometricBounds = Array(myY1, myX1, myY2, myX2)
Rem Add text to the text frame
rem replace from here for the second example
myTextFrame.TextContents = "Adobe Magazine, Publish, MacUser, and ITC's U&lc are examples of magazines that have suspended publication in recent years." _
& vbCr & "Line2:Adobe Magazine, Publish, MacUser, and ITC's U&lc are examples of magazines that have suspended publication in recent years."
Rem Set the change preferences to change to our new character style
myInDesign.ChangePreferences.CharacterStyle = myDocument.CharStyles.Item("XMLCharStyle")
Rem Search for our example magazine titles and format them with the character style
Set myFoundItem = myDocument.Search("Adobe Magazine", False, False, "")
Set myFoundItsem = myDocument.Search("Publish", False, False, "")
Set myFoundItem = myDocument.Search("MacUser", False, False, "")
Set myFoundItem = myDocument.Search("U&lc", False, False, "")
rem replace to here for the second example
Rem Clear change preferences
myInDesign.ChangePreferences = idNothing
Rem Set up the XML infrastructure.
Set myXMLStory = myDocument.XMLElements.Add(myXMLStoryTag, myTextFrame)
Set myXMLBodyText = myXMLStory.XMLElements.Add(myXMLBodyTextTag, myTextFrame.Paragraphs.Item(1))
Rem Find the words that have character style XMLCharStyle applied to them
myInDesign.FindPreferences.CharacterStyle = myDocument.CharStyles.Item("XMLCharStyle")
Set myFoundItems = myDocument.Search("")
For myCounter = 1 To myFoundItems.Count
Set myFoundItem = myFoundItems.Item(myCounter)
Rem Add the XML element (this tags the text with the XML tag)
myXMLBodyText.XMLElements.Add myXMLTag, myFoundItem
Next 'myCounter
Technical Details
Message-ID:
<1de75a7e.0@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!news-hub.cableinet.net!blueyonder!btnet-peer!btnet!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de75a7e.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,aa9b5e6b4780e106 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-16 10:17:50 PST From: "Erwin Schwabe" <erwin.schwabe@wincor-nixdorf.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!news-hub.cableinet.net!blueyonder!btnet-peer!btnet!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: XML caharcter attributes at beginning of a paragraph (VB) Message-ID: <1de75a7e.0@WebX.la2eafNXanI> Date: Thu, 16 Jan 2003 09:44:33 -0800 References: <1de75a7e.-1@WebX.la2eafNXanI> Lines: 47 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit