Paste Operations in the HTML Designer of Visual Web Developer
When you are copying text from other applications into the HTML designer, the behavior that you want to achieve went pasting depends on how you want the text to appear. To accommodate different possibilities, the HTML designer offers two paste commands that are accessible from the Edit menu: Paste and Paste Alternate.
In general, the goal is to allow you to paste the text so that either:
The text looks as much as possible as it did in your source application. For example, if the original text is <b>Example</b>, it is pasted so that when the page is rendered, it looks like <b>Example</b>.
The text is interpreted as markup. For example, if the original text is <b>Example</b>, it is pasted so that when the page is rendered, it looks like Example.
You can paste in both Design view and Source view, so paste behavior depends on the view in which you are working.
Text can be on the Windows Clipboard in a variety of formats, including plain text, HTML, rich-text format (RTF), and others. When pasting text, therefore, the effect of pasting depends on how rich the formatting information is for the text on the Clipboard.
If the text is on the Clipboard as plain text — for example, the text was copied from Notepad or another text editor — the Paste command pastes it as-is. The Paste Alternate command encodes HTML characters.
If the text is on the Clipboard in a rich format (for example, HTML or RTF):
In Design view, the Paste command pastes the text so that it looks like the original. The Paste Alternate command turns formatting information into HTML markup (that is, it encodes the string).
In Source view, the Paste command pastes the text as an unformatted string. The Paste Alternate command encodes the string.
The following table lists the behavior of the two Paste commands under different circumstances. The table takes into account the source of the text (plain text or rich text), where you are pasting the text, and which paste command you use.
Source |
Destination |
Resulting view in the Designer using Paste |
Resulting view in the Designer using Paste Alternate |
---|---|---|---|
Plain text(for example, Notepad) Original: <b>text</b> |
Design view |
text Note In Source view, this text is converted to <strong>text</strong>. |
<b>text</b> Note In Source view, this text is converted to <b>text</b>. |
Plain text(for example, Notepad) Original: <b>text</b> |
Source view |
<b>text</b> |
<b>text<b> |
Rich text(for example, browser or Help) Original: text <b>text</b> |
Design view |
text <b>text</b> Note In Source view, this text is converted to text <b>text<b>. |
text text Note In Source view, this text is converted to text <b>text</b>. |
Rich text(for example, browser or Help) Original: text <b>text</b> |
Source view |
text <b>text</b> |
<b>text</b> <b>text</b> |