Adobe InDesign Scripting

Automated publishing with XML, IDML, and scripting. The flexible XML options, new InDesign Markup Language (IDML), and rich scripting support in Adobe InDesign CS4 and Adobe InDesign CS4 Server software allow you to create powerful automated workflows for publishing content across various systems and output media. This area provides in-depth information about the XML, IDML, and scripting support in InDesign to help you create a strong foundation for custom solutions that meet your unique publishing requirements. 


Keywords Adobe, InDesign, Scripting, Excel, VB

Excel to InDesign (VB)

   Adobe InDesign Scripting Forum Index -> Adobe InDesign Scripting
 
AuthorMessage
sean_balfe (A_T) adobeforums.com
Guest





PostPosted: Mon Jun 28, 2004 2:07 pm    Post subject: Excel to InDesign (VB)



Just wondering if anyone has started scripting (in VB) in this way. I can pull from Access, but some of my data comes from Excel , and I'm not sure how to start.

Thanks, Sean
Back to top
Iolaire_McFadden (A_T) adobeforums.com
Guest





PostPosted: Mon Jun 28, 2004 9:04 pm    Post subject: Re: Excel to InDesign (VB)



Yes,

If you want charts from Excel a good method is to print them using Distiller and link in the resulting PDF files. For data tables I believe there are examples in the forum showing how to paste the table across, otherwise its fairly easy to set the value of an Excel Cell to a variable and then do something the that variable in ID. Excel is fairly easy to script because you can record a lot of actions.

For example each time I want to set up a new (or change the path) on an ODBC data connection, I can record that step and then have some code I can modify.

I'm willing to help if you provide some examples of what you want to do (ID 2.xx only).
iolaire
Back to top
Stu_Bloom (A_T) adobeforums.com
Guest





PostPosted: Sun Jul 04, 2004 12:41 am    Post subject: Re: Excel to InDesign (VB)



I wrote an application to keep InDesign CS tables and Excel data in synch that shows one way to pull data from Excel and place it in InDesign. It might serve as a starting point for you. It's implemented as a VBA application within an Excel template.

You can get it from:

<http://www.earlvillepost.com/indesign%20Table%20Manager/>

I also have a much different version that worked with InDesign 2 and was written in VB 6. If you'd like to see that, let me know, and I'll EMail you the source code.
Back to top
jxswm (A_T) adobeforums.com
Guest





PostPosted: Sun Jul 04, 2004 2:51 am    Post subject: Re: Excel to InDesign (VB)

Very good!
Thanks, Stu Bloom!
I find if the table in Indesign CS there is some merged cells,
The Excel (colunm Value : row Number), like:(A1:B4),CAN NOT be
corresponded to it.
Back to top
Stu_Bloom (A_T) adobeforums.com
Guest





PostPosted: Sun Jul 04, 2004 4:51 am    Post subject: Re: Excel to InDesign (VB)

Actually, it can. You just have to understand how InDesign table cells are named when there is a merged cell and use the corresponding values in the first column of the Excel table.

Lets say I have a table in InDesign like this:




--------------------------------------

Quote:
| |
--------------------------------------
| |
-----------------
| |
--------------------------------------
| |
--------------------------------------






The cells will be named, in order of across rows first, then down columns second:

1:1
2:1
1:2
2:2
1:3
1:4
2:4

Notice that there is no cell 2:3 (column 2, row 3).

All you would need to do in your Excel range would be to omit 2:3 from the first column (where the cell names appear), and it will work.

I can't guarantee this will work for every possible configuration of InDesign tables; if you have an example that it doesn't work for, EMail me the InDesign and Excel files (sbloom (AT) EarlvillePost (DOT) com) and I'll see what I can figure out.

Incidentally, this code will list the names of all the cells in an InDesign table, iterating first across rows and then down columns:




For Each objCell In objTable.Cells
Debug.Print objCell.Name
Next objCell




where objCell is Dim'd as an InDesign.Cell and objTable as an InDesign.Table. I suppose you do have to be aware of InDesign's inane 256-item limit on the For Each construct if the table is big enough.
Back to top
Stu_Bloom (A_T) adobeforums.com
Guest





PostPosted: Sun Jul 04, 2004 5:02 am    Post subject: Re: Excel to InDesign (VB)

On rereading your post, maybe the instructions I have in the PDF that accompanies the Excel template are not clear.

In Excel, you create a two-column table. In the left column, you put the name of the InDesign table cells, which correspond to the column:row coordinates in the InDesign table. You can put this Excel table anywhere you want. The Excel table cell locations do not have to correspond to the InDesign table cell locations. IOW, using the example InDesign table I gave in the previous post, when you run the UpdateTable macro, the values in this Excel table will fill the rows in the right column of the InDesign table with the values 100, 200, 300




J K

450 2:1 100
451 2:2 200
452 2:4 300







where 450, 451, 452 are the row numbers of the Excel table and J and K are the columns of the Excel table.

Note that I skipped 2:3 since there is no cell in the InDesign table named 2:3.
Back to top
   Adobe InDesign Scripting Forum Index -> Adobe InDesign ScriptingAll times are GMT
Page 1 of 1

Related Topics