Learning Curve: Tables for Two12 Jan, 2006 By: Bill Fane Cadalyst
More table functionality is just a right-click away.
It was the end of a two-week vacation. Captain LearnCurve and his gorgeous wife had spent most of Thursday on a Caribbean beach. Well, not exactly. Technically, Bavaro Beach in the Dominican Republic is on the Atlantic Ocean, but the boundary between the Atlantic and Caribbean is just a few miles away, so it is close enough.
Their flight for home left at 10:00 p.m. By the time they factored in an 8-hour flight, a 4-hour time zone difference, plus retrieving their baggage, clearing customs and immigration and driving home, it was now 4:00 a.m. Friday PST time. They hadn't really slept in 24 hours, other than napping on the plane. The first waiting e-mail was from his editor.
"Your next article is due NOW!"
The Captain tried to plead his case, but didn't feel like he was getting a lot of sympathy. Man, it's a tough life.
Last month's article introduced the basic table functionality in AutoCAD 2005 and later. In it, we saw how easy it is to use the Table command's dialog box (Figure 1) to quickly and easily create and populate a table (figure 2).
Figure 1. The Insert Table dialog box.
Figure 2. The table is fully set.
We also saw how to use some of the table editing functionality to change the layout and appearance of a table (figure 3).
Figure 3. You can edit the properties of table contents extensively.
Ah, but this is just the beginning. This month we will explore more of the defining and editing functionalities of tables.
Two Wrongs Do Not Make A Right
But two Wrights made an airplane. Last month's editing involved extensive use of left-clicking sections of the table or within a cell. This time you will see the editing that you can initiate by right-clicking.
In the previous article I noted that the default alignment for text within a cell is centered. I also mentioned that the Text Editing toolbar looked and worked almost exactly like the Mtext editor except that it did not include alignment functions. It is now time to investigate many more table editing functions, starting with text alignment.
Single-click within a table cell to make it active, as shown by the presence of its grips. Now, right-click anywhere on screen (note that this right-click does not have to be within the table boundary), and up comes the context menu (figure 4). I clicked on the Cell Alignment item in order to expand its flyout menu.
Figure 4. The Table Editing Context menu.
I don't need to itemize all the possible actions because most of them are obvious from their names. I will highlight a few points, however.
Click the Cell Borders context menu item to bring up a new dialog box (figure 5). It is very similar to a dialog box in Microsoft Excel. You can assign different line weights and/or colors to the lines that form the boundaries around one or more cells, or to individual lines within the boundaries.
Figure 5. The Cell Border Properties dialog box.
You cannot assign different line types, and you must select the desired properties before making a selection in the Apply To window.
One caution: There is no unselect function. If you pick the top and bottom lines in the Apply To window and then decide you want to apply your selected properties to the top line only, you can't unselect the bottom line. The best you can do is to click on the No Borders button at the right end of the row and then start over.
While we are in the neighborhood, note that if you select No Borders, then the border lines do not disappear in your drawing, but are grayed out. They don't plot, however. If you apply conflicting properties to adjacent cells then the last one in wins at the common cell wall.
You can perform formatting operations on more than one cell at a time. Start by selecting one cell, and then hold the Shift key down as you select another cell. You end up with a rectangular windowed selection of all the cells between the selected two.
Next, right-click to bring up the context menu of figure 4. When you select an operation from this context menu or its flyouts, then AutoCAD will apply it as appropriate to all the cells within the selected set of cells.
Let's Get Together
Maybe you want to merge multiple cells. For example, the Title cell in a table is simply a merging of all the cells in the top row.
Let's assume your company builds two different models of essentially the same product. The only difference is that they may substitute one or more parts, or have added optional items. It is not necessary to build a separate parts list for each model. Simply merge two or more header cells into a single, wider cell that bridges over the ones below it.
Figure 6 shows the results of merging two cells and then inserting a new subhead row below it. It also shows how I modified the cell borders and the text alignment.
Figure 6. Cells can be merged to create subheads.
I Would Give My Right Arm To Be Ambidextrous
So far we've done our right-click editing based on one or more cells. We left-clicked within a cell to activate it, and then right-clicked to get the context menu.
On the other hand, left-click on any cell boundary line and then right-click. You get another context editing menu (figure 7).
Figure 7. The cell boundary line context menu.
This figure does not show the full context menu, only the portion that applies to tables. Once again, the effect of most of the choices is obvious from their labels, but I will draw your attention to one in particular.
Click on Export to bring up a File Save dialog box. This function exports the data within a table as a comma-delimited (CSV) file. This is a simple text file with one line of text for each row in the table. Values within each row are separated by commas.
You can open it in Notepad to see the data and the file format, but it has a more powerful use. Microsoft Excel, and most other spreadsheet or database programs, can open it and turn it back into a spreadsheet or database file. This method is a convenient way of passing drawing information to non-AutoCAD users.
But Wait, There's More!
Believe it or not, I have even more table topics to cover. For example, table cells can contain field text that automatically updates, and they can contain block insertions, and we can create pre-defined named table styles, and AutoCAD 2006 tables can include calculation functions, and the list goes on. Come back next month when we delve into these and other fascinating topics.
And Now For Something Completely Different
If you visit Bavaro Beach in the Dominican Republic, be sure to go on the Bavaro Trackers ATV tour. It is fascinating and a lot of fun. As you ride through the small village the kids will line up along the road and offer a high-five. Resist the temptation to return it, because at the last second the little blighters wind up and slap your hand as hard as they can.
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD video tips. Subscribe to the free Cadalyst Video Picks newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!