Macromedia Dreamweaver 8: Training from the Source

You can add text to a page in a variety of ways, including:

  • Typing into the Macromedia Dreamweaver Document window.

  • Copying and pasting from another application. You can open both Dreamweaver and the application from which you want to obtain content and then copy and paste (or select and drag the text or desired element) into Dreamweaver.

  • Opening an HTML document. You can create HTML documents from a variety of applications, including word-processing programs such as Microsoft Word. To save a Microsoft Word document as HTML, open the document in Word and choose File > Save as Web Page. There are a number of erroneous coding issues with the HTML generated by Word. These problems and their solutions are covered in Lesson 16.

  • Opening text files directly in Dreamweaver. You can use Dreamweaver to open files that were created in word-processing or page-layout applications, provided that those files were saved as ASCII (American Standard Code for Information Interchange) text files. Text (.txt) files always open in a new window using the Code view in Dreamweaver. After opening a text file in Dreamweaver, you can copy and paste the text you need into another document.

Working with ASCII Files

Simple formatting, such as paragraphs and line breaks, can be retained when importing text from ASCII text files, but to properly preserve the line formats you need to account for the differences between the ASCII format on different platforms. Files created in Windows use an invisible control character called a line feed (LF) to indicate a new line within the text, as well as carriage returns (CRs). Macintosh computers do not use the line-feed characteronly CRs. Unix uses only the LF character.

To import text properly from ASCII files and retain the line break formatting, you need to change the Dreamweaver Line Break Type preferences to match the operating system on which the text files you want to import were created.

Edit the preferences by choosing Dreamweaver > Preferences (Macintosh) or Edit > Preferences (Windows) to display the Preferences dialog box and select Code Format in the Category list. From the Line Break Type pop-up menu, select the line break typeeach type is shown with the corresponding operating system, so you can pick the one on which the text file was created. In the Line Break Type menu, your choices are CR LF (Windows), CR (Macintosh), and LF (Unix).

  • For Macintosh users, the default is CR (Macintosh).

  • For Windows users, the default is CR LF (Windows).

1.

Use Dreamweaver to open Lesson_02_Content/Text/home_mac.txt (Macintosh) or home_win.txt (Windows); then select and copy all of the text. Open the Lesson_02_Content/index.html file, make sure the document is displayed in Design view, position the insertion point at the top of the document, and paste the copied text.

Note

For this exercise, choose the document that was created on the same operating system that you are using. You can experiment with importing text files from different platforms by opening the version of this document that was created on the other platform; home_mac.txt was created on a Macintosh computer while home_win.txt was created on a Windows computer. If you choose to experiment on your own with this additional file, remember that you will need to adjust the Line Break Type preferences accordingly, as described in the Working With ASCII Files side bar at the beginning of this exercise.

The index.html document is an XHTML document similar to the one you created in Lesson 1. For additional practice with using Dreamweaver's tools, you can create a new document in the Lesson_02_Content folder and title it, using the skills learned in the previous lesson. You'll need to save it with a different name because you can't have two documents with the same name in the same folder.

You can use the Edit menu to copy and paste the text (choose Edit > Copy and/or Edit > Paste); or you can use the familiar keyboard commands Cmd+C (Macintosh) or Ctrl+C (Windows) to copy, and Cmd+V (Macintosh) or Ctrl+V (Windows) to paste.

2.

Save the index.html file and close the home_mac.txt or home_win.txt file.

You can leave the index.html document open for the next exercise.

Категории