Article View: adobe.scripting.indesign
Article #15255Re: [VB] Copy a table and paste it in a new page
From: Olav_Kvern
Date: Tue, 09 Dec 2003 00:50
Date: Tue, 09 Dec 2003 00:50
39 lines
2485 bytes
2485 bytes
Raymond--
Here's the VBScript version:
Rem MoveTableExample.vbs
Rem
Rem ----------example document setup----------
Set myInDesign = CreateObject("InDesign.Application.CS")
Set myDocument = myInDesign.Documents.Add()
myString = "1a" & vbTab & "1b" & vbTab & "1c" & vbCr & "2a" & vbTab & "2b" & vbTab & "2c" & vbCr & "3a" & vbTab & "3b" & vbTab & "3c" & vbCr & "4a" & vbTab & "4b" & vbTab & "4c"
Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
myBounds = myGetBounds(myDocument.Pages.Item(1), myDocument)
myTextFrame.GeometricBounds = myBounds
myTextFrame.Contents = myString
Set myTable = myTextFrame.Texts.Item(1).ConvertToTable
Rem Add a bit more text--InDesign will crash if we attempt to move *all* of the text in a story.
myTextFrame.InsertionPoints.Item(-1).Contents = vbCr & "A bit more text." & vbCr
Set myParagraph = myTextFrame.Paragraphs.Item(1)
Rem Create the destination text frame.
Set myDestinationPage = myDocument.Pages.Add
myBounds = myGetBounds(myDestinationPage, myDocument)
Set myDestinationTextFrame = myDestinationPage.TextFrames.Add
myDestinationTextFrame.GeometricBounds = myBounds
Rem Now move the table into the new text frame.
myParagraph.Move idLocationOptions.idAtBeginning, myDestinationTextFrame.ParentStory
Rem----------functions---------
Function myGetBounds(myPage, myDocument)
myY1 = myPage.MarginPreferences.Top
myX1 = myPage.MarginPreferences.Left
myY2 = myDocument.DocumentPreferences.PageHeight - myPage.MarginPreferences.Bottom
myX2 = myDocument.DocumentPreferences.PageWidth - myPage.MarginPreferences.Right
myGetBounds = Array(myY1, myX1, myY2, myX2)
End Function
Thanks,
Ole
Technical Details
Message-ID:
<2cced027.4@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2cced027.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,50c714be408c8cfb X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-12-08 17:07:54 PST From: Olav_Kvern@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!news-xfer1.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: [VB] Copy a table and paste it in a new page Message-ID: <2cced027.4@webx.la2eafNXanI> Date: Mon, 8 Dec 2003 16:50:14 -0800 References: <2cced027.-1@webx.la2eafNXanI> Lines: 43 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit