Copy / Paste Code


Copy / Paste formatted text is a nightmare in WordPress.  I’m singling out WordPress because I use it, and, from what I can see, every blog site has this issue.  If you have a SQL Script (again, singled out because that’s what I use), and copy / paste from SSMS to WordPress, it loses all color.  If you put it in Microsoft Word in the middle then that doesn’t look good.  If you put it in Word, save it as HTML, view the source, then paste that source into the text (not visual) when editing a post you’ll end up with extra line breaks and gaps between each line.  What once took 4 lines in SSMS now takes 12.  Who cares about how long it is, no one will want to read it.

The best solution so far is a program called vs2html.exe, which I found here: http://www.jeffblankenburg.com/2008/10/07/tutorial-6-visual-studio-code-highlighting-to-html/

Copy what you want straight out of SQL Server Management Studio, run this program, paste into the text editer in WordPress.  To get to the text editer you need to save and edit your post, then click on “Text” instead of the default “Visual”.  When you get there you just paste it where you want it.

About these ads

3 thoughts on “Copy / Paste Code

I like comments.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s