Article View: adobe.scripting.indesign
Article #18912Re: Question for Ole on style to tag mapping
From: pjredman
Date: Fri, 31 Jan 2003 23:08
Date: Fri, 31 Jan 2003 23:08
29 lines
2054 bytes
2054 bytes
Ole,
For some reason I was inspired to try again. Here's what I've come up with. This is for a document that has a predifined set of tags so it's sort of "hard wired". It works great when there's only one story but fails when there are more than one. Any advice?
Private Sub Command1_Click()
Dim myInDesign As InDesign.Application
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set myDocument = myInDesign.ActiveDocument
For myStoryCount = 1 To myDocument.Stories.Count
Set myStory = myDocument.Stories.Item(myStoryCount)
Set myTextFrame = myDocument.TextFrames.Item(myStoryCount)
myXMLTag = "Story"
Set myXMLStory = myDocument.XMLElements.Add(myXMLTag, myTextFrame)
For myParaCount = 1 To myStory.Paragraphs.Count
Set myPara = myStory.Paragraphs.Item(myParaCount)
Select Case myPara.ParagraphStyle
Case "First Style"
myXMLTag = "firststyle"
Set myXMLPara = myXMLStory.XMLElements.Add(myXMLTag, myPara)
Case "Second Style"
myXMLTag = "secondstyle"
Set myXMLPara = myXMLStory.XMLElements.Add(myXMLTag, myPara)
End Select
Next
Next
End Sub
Thanks,
Phil
Technical Details
Message-ID:
<1de7a030.4@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de7a030.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,1f88565c9e628a0b X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-01-31 15:37:52 PST From: pjredman <pjredman@usgs.gov> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!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: Re: Question for Ole on style to tag mapping Message-ID: <1de7a030.4@WebX.la2eafNXanI> Date: Fri, 31 Jan 2003 15:08:37 -0800 References: <1de7a030.-1@WebX.la2eafNXanI> Lines: 34 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit