Importing and Exporting Tabular Data


Because tables are best used for tabular data, it stands to reason that Dreamweaver has an easy way to import such data (from database programs or Microsoft Excel, for example) and turn it into a table. This data needs to be in the form of a delimited text file , that is, a file that includes the data, separated by some character, such as a tab, a comma, or another delimiter .

To explain how a delimited file works, imagine that you have some data that would be displayed well in a table, such as baseball standings. Each row of the table with the standings contains information on a team, and the different columns of the table contain the team's name , number of wins, number of losses, and winning percentage, as in the example (shown in Excel) in Figure 9.36 . To use this Excel data in Dreamweaver, you first need to export the data out of Excel as a delimited file, which is easy; you simply save a copy of the file in the "Text (Tab delimited)" format. This saves the data in the Excel worksheet as a plain text file. Each column of data is separated by a tab character, and each row of the data ends with a return character. Dreamweaver can then read in this delimited text file and convert it into a table.

Figure 9.36. Tabular data to be imported into Dreamweaver will often start out as a Microsoft Excel worksheet.


Dreamweaver can also do the reverse trick of turning the data in a table into a delimited text file. This allows you to export table data to Excel or a database program for further processing, or you can take a table on a Web page and move it to a word processor or page layout program such as Adobe InDesign.

To import tabular data into a table:

1.
Place the insertion point where you want the table to appear.

2.
Choose File > Import > Tabular Data.

or

Choose Insert > Table Objects > Import Tabular Data.

The Import Tabular Data dialog appears ( Figure 9.37 ).

Figure 9.37. Use the Import Tabular Data dialog to select the delimited text file and format the table you are about to create.


3.
Click the Browse button to select the delimited data file.

The Open dialog appears.

4.
Navigate to the data file, select it in the Open dialog, then click Open.

The name of the data file appears in the Import Tabular Data dialog's "Data file" text box.

5.
From the Delimiter pop-up menu, choose the delimiter character used in the data file.

Your choices in this pop-up menu are Tab, Comma, Semicolon, Colon , and Other. If the data file uses an unusual delimiter character, choose Other and type that character into the text box next to the Delimiter pop-up menu.

6.
In the "Table width" section, choose "Fit to data" if you want the table width to be just as wide as the data, or "Set to" if you want the table to be a fixed width. If you choose the latter option, enter a number in the text box and choose the units from the pop-up menu (either percent or pixels).

7.
As you prefer, enter values for cell padding, cell spacing, and the table border. You can also choose to format the text in the top row of the table (which is usually a header of some sort ). Your choices are no formatting, bold, italic, or bold italic.

8.
Click OK.

Dreamweaver reads the delimited text file and inserts it into your page as a formatted table ( Figure 9.38 ).

Figure 9.38. The formatted table, built from the imported data, appears in your document.


Tip

  • If the table imports incorrectly, chances are that the data file uses a delimiter different from the one you chose in step 5. You will have to delete the incorrect table and import it again with the correct setting.


To export a Dreamweaver table's data to a delimited file:

1.
Place the insertion point in any cell of the table.

2.
Choose File > Export > Table.

The Export Table dialog appears ( Figure 9.39 ).

Figure 9.39. Use the Export Table dialog to save the data from a Dreamweaver table as a delimited text file.


3.
From the Delimiter pop-up menu, choose the delimiter character you want to use in the exported text file. Your choices are Tab, Space, Comma, Semicolon, or Colon.

4.
From the "Line breaks" pop-up menu, choose the operating system that is the destination for the text file. Your choices are Windows, Mac, or UNIX.

The reason for this option is that each of the platforms has a different way of indicating the end of a line of text.

5.
Click Export.

The Export Table As dialog appears.

6.
Give the file a name, navigate to where you want to save it, and click Save.

Dreamweaver saves the table data as a delimited text file.

Tip

  • If you only want to export a portion of a table, for example the top ten rows, select those rows, copy them, then paste them into a different part of the document, where they will create a new table. Export the new table as a delimited text file, then delete the new table.





Macromedia Dreamweaver 8 for Windows & Macintosh Visual QuickStart Guide
Macromedia Dreamweaver 8 for Windows & Macintosh
ISBN: 0321350278
EAN: 2147483647
Year: 2005
Pages: 239

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net