Circles and Lines: Terrific Tables!15 Apr, 2005 By: Lynn Allen Cadalyst
Easily create and customize tables with AutoCAD 2005 Tables
We all know what it's like to draw our various charts and tables line by line by line. We also know what it's like to need to add a row or column in the middle of our tables -- yikes! I'm sure you've discovered tricks for making this task as painless as possible, but no trick can compare to the power of the new AutoCAD 2005 Tables. It's easy to add rows and columns, and add or edit text. No need to line everything up - AutoCAD does the work for you. These tables have all the good things about Excel without the not-so-good things. You also can easily bring existing Excel spreadsheets in as new table objects (no more OLE!), and you can save AutoCAD tables in a format read by either Excel or Access.
So where do you begin? You start by creating a table style. Just as you create dimension styles for your dimensions and text styles for your text, you need to set up the various parameters you want your tables to follow -- enter the Tablestyle command.
The Tablestyle command consists of three tabs: Data, Column Heads and Title. Let's take a look at these tabs individually to ensure your tables are set up exactly the way you want them.
The Data tab, as shown in figure 1, controls the way your standard data appears within the table. Here you define the text style, height, color, alignment and whether or not you want the table cells to be a specific color. This information creates the default text style, but you can easily make changes to the individual text strings within your tables. Also decide which, if any, grid lines you want to display, their lineweight and the color for the standard data cells. The dynamic preview pane displays how your final table will appear.
Figure 1. The Data tab creates the default text style for your table.
Note that the Column Header tab is identical to the Data tab, except for an additional option that lets you turn off the Header row. The Title tab is also identical to the Data tab except for an option to turn off the Title row.
All three of the tabs let you define the overall table direction and cell margins. You can choose to have the rows go up (like a revision table) or down (like a bill of materials). You also can control the cell margins, which is the distance between the edge of the cell and the actual cell content.
After you create your first table style, you are ready to try the New Table command, shown in figure 2. Here you select the table style to assign to your new table. You also indicate the number of columns and rows as well as their respective width and height. These values are not cast in stone as it is easy to add/remove both columns and rows as well as change their size.
Figure 2. Select your table style, the number of columns and rows, and the width and height of your cells with the New Table command.
If you choose to specify a window to insert your table, AutoCAD determines the size of the columns and rows for you based on the size of the window. Or, if you choose to select a specific row or column height/width, AutoCAD inserts as many rows and/or columns as will fit within the designated window. The choice is yours.
After you've set up the various parameters, you can create your table. Then it's just a matter of filling in the data. Simply go to a cell and start typing -- the Mtext command automatically jumps in to help you. You can easily tab or arrow across, up or down to continue adding or editing text strings -- super simple!
The Shortcut menu is really the magical key to editing your table, as shown in figure 3. Here you can control the individual cell alignment (the position of the text within a cell) and the cell border grid lines, insert and delete rows or columns, merge multiple cells together, etc. The Match Cell option works much like the Matchprop command, letting you duplicate the contents of any existing cell. If you have multiple cells that contain the same data, this option is for you.
Figure 3. Use the Shortcut menu to edit your table.
Inserting a block into a table cell is easy, as shown in figure 4. You can control the size of the inserted block two ways: AutoCAD can fit the block into the existing cell size, or you indicate a scale factor and AutoCAD modifies the table row or column size where needed. You also can control the block alignment within the cell as well as the rotation angle.
Figure 4. You can insert a block into a table cell.
Grips make it easy to move the columns and rows around as well as resize the entire table. If you select multiple cells to edit, you'l see two additional options pop up in the Shortcut menu: Size Rows Equally and Size Columns Equally (which come in handy should you mess up your row/column sizes with your grips).
If you need to change the overall properties of the entire table after the fact, use the Properties command.
Do you have existing Excel spreadsheets you'd like to bring in as new table objects? Just highlight the Excel table and copy it to the clipboard. No more evil OLE. Then select Paste Special from the Edit menu in AutoCAD and select AutoCAD Entities as shown in figure 5. The Excel spreadsheet magically appears; simply place it in the desired location. You'll find that Mtext is automatically fired up so you can edit the contents of the table where needed.
Figure 5. Use Paste Special to copy Excel spreadsheets into AutoCAD.
You can go the other direction as well. The Tableexport command sends any table out to a file in .CSV (comma delimited) format. Excel or Access can easily open .CSV files. I did notice that the headers and title weren't differentiated from other cells when brought into Excel, so you may need to do a little manipulating to get the desired outcome.
Note that these tables are not linked. Hence, if you edit the Excel spreadsheet you pasted into AutoCAD, the AutoCAD table unfortunately won't update automatically. You need to delete the original table and reinsert the updated one.
That's the new table functionality in a nutshell. I think you're going to find it easy to work with, and light years better then what we've had to do in previous releases. Until next month -- Happy AutoCADing!
Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!