|< Day Day Up >|
2.2 Copying and Pasting Text
If 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 MX 2004 includes new 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 FileImportWord/Excel Document (see Section 2.4).
2.2.1 Simple Copy and Paste
For non-Microsoft-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 it梂ordPerfect, AppleWorks, your email program, or whatever. Select the text you want (by dragging through it, for example), or choose EditSelect All (Ctrl+A [-A]) to highlight all text in the document. Then choose EditCopy, or press Ctrl+C (-C), to copy it. Switch to Dreamweaver, click in the document window where you wish the text to go, and choose EditPaste (Ctrl+V [-V]).
When you copy from any program other than Microsoft Word or Excel, 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.
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 in Section 220.127.116.11.
2.2.2 Pasting Text from Word: The Basic Method
One of the most frustrating things about earlier versions of Dreamweaver was their inability to maintain basic formatting, like bold and italics, when copying and pasting from Microsoft Word. Worse, even simple paragraphs would sometimes be merged into a single glob.
But no more! Dreamweaver MX 2004 now 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 sense梐nd Dreamweaver's CSSbased formatting tools梩o 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 don't have to spend a lot of time reformatting the pasted text (see Figure 2-4), since many basic formatting options are preserved:
There are a couple of caveats with this feature. First, you can't copy and paste more than 300 K 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 only works with versions of Word later than Office 97 (for Windows) or Office 98 (for Mac).
Dreamweaver MX 2004 now lets you paste Word text (and graphics)條ike the contents of the Word file at top梚nto a Web page while preserving basic formatting options like headlines, italics, paragraphs, and bold (bottom left). The Paste Formatted 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 right is about 10 percent larger than the one on the left.
2.2.3 Pasting Text with Word Formatting
If you simply must keep that three-inch tall, orange text and crazy cartoon-like font, you can turn to another new Dreamweaver MX 2004 feature桺aste Formatted.
After copying text from Word and returning to Dreamweaver, choose EditPaste Formatted, or press Ctrl+Shift+V (-Shift-V). Dreamweaver pastes the text with as much formatting as possible, including margins, fonts, and text colors and sizes (see Figure 2-4). Behind the scenes, Dreamweaver pastes the text and adds Cascading Style Sheet codes that attempt to approximate the look of the text in Word.
Unfortunately, all of 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 formatting梥uch as uncommon font faces. For these reasons, use this feature with caution.
2.2.4 Pasting Excel Spreadsheet Information
Dreamweaver MX 2004 offers two methods of pasting information from Microsoft Excel, too: a basic method, using the standard Ctrl+V (-V) or EditPaste; and a format-rich method, using Shift+Ctrl+V (Shift--V) or EditPaste Formatted. 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 Paste Formatted command, however, preserves advanced formatting like font, font size, text color, and cell background colors.
Strangely, though, this command only retains formatting applied to an entire cell in Excel. If you use Paste Formatted on an entire cell of bolded text?UFO Sightings Since 1996"梩he text does remain bold. But if you've included a combination of plain and italicized text in one cell?Ad Sales Data for The National Exasperater," for example?span class="docEmphasis">none of the italicized text will appear italicized in Dreamweaver. Kind of confusing? It certainly is, so you'll need to closely check any Excel data you paste into a Dreamweaver document. It may require some fine-tuning to make it look just right.
To make matters worse, even if you just use your basic EditPaste to get Excel data into Dreamweaver, you frequently end up with useless CSS code (class attributes, to be specific) applied to most cells in the table. For example, you can end up with HTML code like this: <td class="xl33">. (All this CSS is explained fully in Chapter 6.)
2.2.5 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 FileImportWord 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 the EditPaste. That is, for Word documents, Dreamweaver carries over basic formatting like bold, italics, headlines, and paragraphs, and imports and converts images. The importing process doesn't create style sheets or apply advanced formatting. For Excel documents, you get just an organized table of data梟o formatting.
|< Day Day Up >|