2.2. Copying and Pasting TextIf you're building Web sites as part of a team or for clients , your writers are likely to send you their copy in the form of word processing documents. If the text comes in a Microsoft Word document or Excel spreadsheet, you're lucky. Dreamweaver 8 includes commands for pasting text from these two types of files. If you're using Windows, you can even import those kinds of files directly into a Web page using File Import Word/Excel Document (see Section 2.2.6). 2.2.1. Simple Copy and PasteFor nonMicrosoft-spawned text, you can, of course, still simply copy and paste like generations of Web designers before you. Open the document in whatever program created itWordPerfect, AppleWorks, your email program, or whatever. Select the text you want (by dragging through it, for example), or choose Edit Select All (Ctrl+A [ -A]) to highlight all text in the document. Then choose Edit Copy, or press Ctrl+C (-C), to copy it. Switch to Dreamweaver, click in the document window where you wish the text to go, and then choose Edit Paste (Ctrl+V [ -V]). This routine pastes the text into place. Unfortunately, you lose all text formatting (font type, size , color , bold, italic, and so on) in the process, as shown in Figure 2-3. Furthermore, you may find that pasted paragraphs are separated by line break characters , not standard carriage returns. Strangely enough, this means that when you paste in a series of paragraphs, Dreamweaver treats them as though they were one gargantuan paragraph. These line-break characters can pose problems when trying to format what you think is a single paragraph. To identify these line breaks, see the note on Section 2.1.3. Tip: If you have to copy and paste text from other programs, there's a way to get paragraphs (and not just lines separated by the line-break character) when you paste into Dreamweaver: make sure whoever's typing up the original documents inserts an extra paragraph between each paragraph of text. Pressing Enter (or Return) twice at the end of a paragraph inserts an empty paragraph. When you copy and paste, Dreamweaver removes the empty paragraphs and pastes the text as regular paragraphs. Figure 2-3. Usually when you copy from any program other than a Microsoft Office program (Word, Excel, and so on) as shown at top, and paste into Dreamweaver, as shown at bottom, all formatting is lost, and paragraph breaks are replaced by line breaks. The little icon that appears at the end of the first line at right represents the invisible line break.2.2.2. Paste SpecialActually, the previous explanation isn't exactly true. Dreamweaver 8 has added some new text-pasting features, some of which it attempts to use whenever it pastes text. Dreamweaver 8 actually supports four different types of paste methods , ranging from plain text to highly formatted HTML:
Note: Note to Windows owners : You can copy an entire page of HTML from Firefox or Internet Explorer and paste it into Dreamweaver. Click inside a Web page, press Ctrl+A to select the entire page, and then press Ctrl+C to copy the HTML. Then, switch to Dreamweaver, click inside an empty page, and press Ctrl+V to paste. All the HTML is copied, and even graphics appear. This text comes in with "full formatting," but note that external style sheets (see Section 6.1.2) do not come along for the ride. You can override Dreamweaver's default behavior and choose a different method for pasting by using the Paste Special command. Choose Edit Paste Special to open the Paste Special window (see Figure 2-4). Here, you can choose which of the four techniques you wish to use sort of. Youre limited to what Dreamweaver can paste. For nonMicrosoft Office products, you can only use the first two options the others are grayed outwhereas with text copied from Word or Excel, you can choose from any of the four. Figure 2-4. The Paste Special command lets you paste text copied from other programs. If you want Dreamweaver to apply the same setting each time you use the Paste Special command, click the Paste Preferences button. This opens the Preferences window. Select whatever settingsBasic formatting, for examplethat you want Dreamweaver to apply every time you use the Paste Special command.In general, Dreamweaver's default settings are a good place to start for text copied from most programs. For Word or Excel information, there are a few options worth considering, as described next. 2.2.3. Pasting Text from Word: The Basic MethodWhile text from other applications doesn't retain much beyond paragraph formatting when pasted into Dreamweaver, Dreamweaver 8 includes both basic and advanced methods of copying and pasting Word text. You can even paste spreadsheet information from Excel, complete with rows, columns , and cells . Frequently, you'll just want to preserve basic formatting like bold or italic text, headlines, and bulleted lists. You won't need (and in most cases, won't want) more extravagant formatting like different fonts, colors, or margin settings. After all, you're the Web designer, and you'll use your own design senseand Dreamweaver's CSS-based formatting toolsto add beauty to basic text. Pasting Word text works like any copy/paste action described in the previous section. Just select the text in Word, copy it, switch to Dreamweaver, and then choose Edit Paste to drop it into a Web page. You dont have to spend a lot of time reformatting the pasted text (see Figure 2-5), since many basic formatting options are preserved:
Note: There are a couple of caveats with this feature. First, you can't copy and paste more than 300 KB worth of text, so you have to transfer really long documents in pieces (or better yet, spread them out among multiple Web pages). And second, this feature works only with versions of Word later than Office 97 (for Windows) or Office 98 (for Mac). 2.2.4. Pasting Text with Word FormattingIf you simply must keep that three-inch-tall, orange-text, crazy-cartoon-like font, you can turn to the "Full Formatting" option of the Paste Special command. After copying text from Word and returning to Dreamweaver, choose Edit Paste Special or press Ctrl+Shift+V (-Shift-V). When the Paste Special window appears, choose the "Full Formatting" option and click OK. (If you want this to be the default setting, so that you always paste the full formatting from Word, turn on the "Use these settings" checkbox before clicking OK in the Paste Special window.) Dreamweaver pastes the text with as much formatting as possible, including margins, fonts, and text colors and sizes (see Figure 2-5). Behind the scenes, Dreamweaver pastes the text and adds Cascading Style Sheet code that attempts to approximate the look of the text in Word. Figure 2-5. Dreamweaver 8 lets you paste Word text (and graphics)like the contents of the Word file (top)into a Web page, while preserving basic formatting options like headlines, italics, paragraphs, and bold (bottom left). The Paste Special command lets you preserve more advanced formatting such as font faces, colors, sizes, and margins (bottom right). But this special treatment comes at a price: the file size of the page on the bottom right is about 10 percent larger than the one on the bottom left.Unfortunately, all this extra code increases the document's file size and download time and can interfere with future formatting changes. What's worse, most of your visitors won't even be able to see some of this formattingsuch as uncommon font faces. For these reasons, use this feature with caution. 2.2.5. Pasting Excel Spreadsheet InformationDreamweaver 8 also lets you paste information from Microsoft Excel. Options include a basic method, using the standard Ctrl+V ( -V) or Edit Paste, and a format-rich method, using the "Full Formatting option of the Paste Special window: choose Edit Paste Special (or press Ctrl+Shift+V [ -Shift-V]), choose Full Formatting from the Paste Special window, and click OK. Both methods paste spreadsheet information as an HTML table composed of cells, rows, and columns. (See Chapter 7 for more on tables.) But unlike pasting from Word, the basic Paste command from Excel preserves no formatting: it doesn't even hang on to bold and italics. The Full Formatting option, however, preserves advanced formatting like font, font size, text color, and cell background colors. 2.2.6. Importing Word and Excel Documents (Windows)Windows fans can also import material directly from a Word or Excel file into any Dreamweaver document. Just place the cursor where you wish to insert the text or spreadsheet, and then choose File Import Word Document (or Excel Document). An Open file dialog box appears; find and double-click the Word or Excel document you wish to import. Dreamweaver captures the information just as if you'd used Edit Paste. That is, for Word documents, Dreamweaver carries over basic formatting like bold, italics, headlines, and paragraphs, and imports and converts images. The importing process doesnt create style sheets or apply advanced formatting. For Excel documents, you get just an organized table of datano formatting.
|