< Day Day Up > |
7.11 Tabular DataSo far, you've learned about using tables for complex Web page designs, using tricks like merging cells, invisible spacer images, and Dreamweaver's Layout mode. But what about the original purpose of a table梔isplaying data in an orderly manner? You can still do that, of course, and Dreamweaver provides a couple of tools to make the process of dealing with tabular data run smoothly.
7.11.1 Importing Data into a TableYour boss emails you your company's yearly sales information, which includes data on sales, profits, and expenses organized by quarter. She asks you to get this up on the Web for a board meeting she's having in half an hour. This assignment could require a fair amount of work: building a table and then copying and pasting the correct information into each cell of the table, one at a time. Dreamweaver makes your task much easier, because you can create a table and import data into the table's rows and columns, all in one pass. In order for this to work, the table data you want to display must begin life in a delimited format梐 task that most spreadsheet programs, including Excel, or database programs, such as Access or FileMaker Pro, can do easily. (Choosing FileExport or FileSave As in these programs usually does it.) In a delimited file, each line of text represents one table row. Each line is divided into smaller units using a special character called a delimiter梞ost often a tab, but possibly also a comma or colon. Each unit represents a single cell in the row. In a colon- delimited file, for example, the line Sales:$1,000,000:$2,000,000:$567,000:$12,500 would be converted by Dreamweaver into a row of five cells, with the first cell containing the word Sales. Once you've saved your boss's spreadsheet as a delimited file, you're ready to import it into a Dreamweaver table:
The Import Table Data dialog box lets you select a text file of data to import and to choose formatting options for the table.
If you'd like to jazz up your table a bit, but are short on time, you can apply one of Dreamweaver's preinstalled table designs (see Figure 7-27). Dreamweaver can apply canned designs to a table of data. Select a table in the document window, and choose Commands Format Table. You can then select one of the 17 different designs from the list. You can even create your own design using the option menus. Unfortunately, you can't save a design you create. While these designs aren't useful when you're using tables to lay out a page as described earlier in this chapter, they are a quick way to spruce up a calendar or spreadsheet.7.11.2 Sorting Data in a TableIf you have a table that lists employee names, you probably want to present that list in alphabetical order梠r alphabetically and by department. Dreamweaver's Sort Table command takes a lot of the drudgery out of this task.
The Sort Table command works well with Dreamweaver's Import Tabular Data feature. Imagine you're given a text file listing all of the employees in your company. You import the data into a table, but realize that the names aren't in any particular order. Use the Sort Table command, as described on the facing page, to put the list of names into alphabetical order by last name.
7.11.3 Exporting Table DataGetting data out of a table in Dreamweaver is simple. Just select the table and choose FileExportExport Table. In the Export Table dialog that appears, select the type of delimiter (tab, comma, space, colon, or semicolon) and operating system where the file will be used (Mac, Windows, or Unix), and then click OK. Give the file a name and save it on your computer. You can then import this delimited file into your spreadsheet or database program. |
< Day Day Up > |