Clean Code on Paste

Tina Clarke

Perhaps you have an old web you wish to revamp with EW? Or you need to use the content from Word files for your site? Whatever the case may be, Expression Web has many insider tricks to help you achieve your goal of a fully validating site that will work in all browsers.



The Quick Fix Expression Web Clean code method

Expression Web has revamped the Paste Feature and now boosts one of the easiest commands that gets results fast.

Lets say for example you either need to clean pages where you have pasted content directly from word or you need to paste content from word into your pages. (Content pasted from Word contains code that will bloat out your web pages and break your validation).

You can always paste into notepad and clear out all the old formatting that way, however if you have linked text you will lose those hyperlinks. A much quicker way with EW is to use the 'Paste Text' feature and not only retain hyperlinks but strip all the formatting.

Edit | Paste Text lets you control how the paste will appear and what code will be inserted from the place you copied or cut from.

Paste Text Dialog Box.


Fig 1 - Paste Text Dialog Box



Take a look at Fig 1 above, make sure to tick the 'Preserve Hyperlinks' or they will be lost. It depends on what your pasting but if your pasting paragraphs select, 'Normal paragraphs without breaks' and your text will be pasted in intact with paragraphs and hyperlinks but no extra formatting in the x/html code.

Paste Formatting Selections.


Fig 2 - Table of selections available and what they do for the Paste Text dialog box




How to paste clean content from Word or other office products the quick way

Huh! I can hear you asking. Yes I did just tell you a quick fix for clean code, but there is an even faster way. If like me your an Expression Web lazy crafter and love using the right hand dialog menus to get work done faster rather than having to move your hands and use the menu or the keyboard.

First lets make sure the 'Show Paste Options' button is ticked in 'Page Editor Options' in the 'General' Tab under the 'Tool' menu. It should be if you followed my Page Editor Options - General Tab Tutorial on Setting up Expression Web.

NOTE: For a handy reference please download the Free Setting up Expression Web Ebook

Paste Icon.Fig 3 - Paste Icon

Now when you right click on the mouse and choose paste a little icon will appear ( See Fig 3 above ). Mouse over the icon and a down arrow will emerge as you can see in Fig 4 below. Click the arrow and the icon will expand with a selection of choices as you can see below.

Paste Icon Expanded.


Fig 4 - Paste Expanded













Choose 'Keep Text Only' from the selections and the 'Paste Text 'Dialog Box will appear (See Fig 1) As I outline after Fig 1 select  'Normal paragraphs without breaks', make sure 'Preserve Hyperlinks' is ticked too and press ok.

Isn't that much faster? Formatting stripped with paragraphs and hyperlinks intact all in a jiffy.

Paste Expanded with Match Destination Formatting selection.


Fig 5 - Paste Expanded with Match Destination Formatting selection




You might notice the new selection on Fig 5 above, 'Match Destination Formatting'. This occurs when you paste into your document content that contains a style that has the same name as a style that is already in your document. You use this selection to make sure your own styles are used and not those from the document you just copied from.

Below is a full explanation of this and the other selections from the Expanded paste Icon.

Fig 6 - Explanations of the Paste Icon Expanded selections

Explanations of the Paste Icon Expanded selections.



Tina Clarke Signature.
Cheshire Web Designs - Cheshire website Designs by Any Expression Web Designs
Owner Any Expression Web Designs and Clarke Abstract Art

Copyright © 2006 - 2011 Tina Clarke of Any Expression Web Designs All Rights Reserved

Are you looking for a Web Designer?
Web Designs created by Any Expression Web Designs