🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19841

Re: Database Driven Catalog - ???

#19841
From: Brian C. Carter
Date: Mon, 18 Nov 2002 20:05
120 lines
5963 bytes
Here is where I am at now. All I need is to have it create a new page and perform the setup as well. I think I am calling it right, but I'm not quite sure 
========================================= 

Public Function SetupPage() 

Dim myInDesign As InDesign.Application 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set myDocument = myInDesign.ActiveDocument 
Set myPage = myDocument.Pages.Item(1) 
'Set myPage = myDocument.Pages.Add 
'myDocument.DocumentPreferences.NumberOfPages = 10 
myPage.AppliedMaster = myDocument.MasterSpreads.Item(1) 
myPageWidth = myDocument.DocumentPreferences.PageWidth 
myPageHeight = myDocument.DocumentPreferences.PageHeight 
myInDesign.ActiveDocument.ViewPreferences.HorzMeasurementUnits = idMSInches 
myInDesign.ActiveDocument.ViewPreferences.VertMeasurementUnits = idMSInches 
myMarginLeft = myPage.MarginPreferences.MarginLeft 
myMarginTop = myPage.MarginPreferences.MarginTop 
myMarginRight = myPage.MarginPreferences.MarginRight 
myMarginBottom = myPage.MarginPreferences.MarginBottom 
myGutter = myPage.MarginPreferences.ColumnGutter 
myColumns = myPage.MarginPreferences.ColumnCount 
myRows = 4 
myCW = (((myPageWidth - (myMarginLeft + myMarginRight)) - (myGutter * (myColumns - 1))) / myColumns) 
myRH = ((myPageHeight - (myMarginTop + myMarginBottom + (myGutter * (myColumns - 1)))) / myRows) 

myColumnCounter = 0 
myRowCounter = 0 
Do 
    myRowCounter = 0 
        Do While myRowCounter < 4 
            myTop = ((myRowCounter * myRH) + (myGutter * myRowCounter)) + myMarginTop 
            myBottom = ((((myRowCounter + 1) * myRH) + (myGutter * myRowCounter)) + myMarginTop) 
            myColumnCounter = 0 
                Do While myColumnCounter < 4 

myLeft = ((myColumnCounter * myCW) + (myGutter * myColumnCounter)) + myMarginLeft 
                            myRight = (((myColumnCounter + 1) * myCW) + (myGutter * myColumnCounter)) + myMarginLeft 

Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add 
                            myTextFrame.GeometricBounds = Array(myTop, myLeft, myTop + (myRH / 4), myRight) 
                            myTextFrame.Label = "Name-" & myPage & myColumnCounter + 1 & "-" & myRowCounter + 1 

Set myTextFrame2 = myDocument.Pages.Item(1).TextFrames.Add 
                            myTextFrame2.GeometricBounds = Array(myBottom - (myRH / 8), myRight, myBottom, myLeft) 
                            myTextFrame2.Label = "Info-" & myPage & myColumnCounter + 1 & "-" & myRowCounter + 1 

Set myRectangle1 = myDocument.Pages.Item(1).Rectangles.Add 
                            myRectangle1.GeometricBounds = Array(myTop + (myRH / 4), myLeft, myBottom - (myRH / 8), myRight) 
                            myRectangle1.Label = "Photo-" & myPage & myColumnCounter + 1 & "-" & myRowCounter + 1 

myColumnCounter = myColumnCounter + 1 
                Loop 
            myRowCounter = myRowCounter + 1 
        Loop 
    If myRowCounter = 4 Then 
    Exit Do 
    End If 
Loop 

End Function 

Public Function DBtoID() 
Dim db As DAO.Database 
Dim rs As DAO.Recordset 
Set db = CurrentDb 
Set rs = db.OpenRecordset("Madison Items", dbOpenDynaset) 
Dim myInDesign As InDesign.Application 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set myDocument = myInDesign.ActiveDocument 
Set myPage = myDocument.Pages.Item(1) 
iPage = 1 

myColumnCounter = 0 
myRowCounter = 0 

SetupPage 'myPage, 1 

Do While Not rs.EOF 
            Do 
                    Do While myColumnCounter < 4 
                        sBuf1 = rs!Pre 
                            sBuf2 = rs!Description 
                            sBuf3 = rs!Sub 
                            iFrame = "Name-" & myPage & myColumnCounter + 1 & "-" & myRowCounter + 1 
                            Set iTextFrame = myPage.TextFrames.Item(iFrame) 
                            iTextFrame.InsertionPoints.Item(-1).TextContents = sBuf1 & vbCr & sBuf2 & vbCr & sBuf3 

sBuf4 = rs!Number 
                            sBuf5 = rs!Pak 
                            iFrame = "Info-" & myPage & myColumnCounter + 1 & "-" & myRowCounter + 1 
                            Set iTextFrame = myPage.TextFrames.Item(iFrame) 
                            iTextFrame.InsertionPoints.Item(-1).TextContents = sBuf4 & vbTab & sBuf5 

On Error Resume Next 
                        sBuf4 = rs!Number 
                            myFile = "D:\Madison\" & sBuf4 & ".eps" 
                            irFrame = "Photo-" & myPage & myColumnCounter + 1 & "-" & myRowCounter + 1 
                            Set iRectFrame = myPage.Rectangles.Item(irFrame) 
                            iRectFrame.Place myFile 
                            iRectFrame.Fit idProportionally 
                            iRectFrame.Fit idCenterContent 

rs.MoveNext 

myColumnCounter = myColumnCounter + 1 
                    Loop 

myColumnCounter = 0: myRowCounter = myRowCounter + 1 

If myRowCounter = 4 Then 
                Exit Do 
                End If 
            Loop 
    Set myPage = myDocument.Pages.Add(1) 
    SetupPage 
Loop 

rs.Close 
End Function
Technical Details
Message-ID: <1de69529.26@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!isdnet!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.esat.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de69529.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,4348409c0a586298
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-11-18 12:51:10 PST
From: "Brian C. Carter" <brian@samardist.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-04!supernews.com!isdnet!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.esat.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Database Driven Catalog - ???
Message-ID: <1de69529.26@WebX.la2eafNXanI>
Date: Mon, 18 Nov 2002 12:05:40 -0800
References: <1de69529.-1@WebX.la2eafNXanI>
Lines: 147
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit