Click here to Skip to main content
15,886,199 members
Articles / Database Development / SQL Server
Tip/Trick

Paste Table Data into an Editor Then Quickly Format for Good Appearance

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
8 Feb 2017CPOL2 min read 3.4K  
Use ALT+SHIFT to "block" select text (thinking of justifying columnar relations of words/data/etc. so the visual appearance is perfectly tabular) ... and TAB (TAB+SHIFT to undo) to MOVE SELECTION right (and left) ...

Introduction

Confounded by whitespace and spongey/springey non-printing characters coming to light in text or source you've pasted into Visual Studio or SQL Server editor when the "columns" no longer align because the "columns" don't exist anymore? Here's a quick tip/trick which would have been very useful to you way back when ... but still is to the freshly initiated.

Background

You've been using Visual Studio and/or SSMS editors for years. You wish to comment on your code. Perhaps you run a QUERY and have a data table as a result in GRID view. You copy the table with headers to paste into a comment block. None of the expandable headers to the tables show up in the rows of data! Manual editing to align all the items to make it readable once again (and preserve the comment) takes too much time.

No Code, Just this Tip

Place your cursor after some whitespace in the fresh paste. Choose THIS upper left corner for the move block because it aligns with a larger selection of well-aligned items (as opposed to a visual break in the pasted data where the length of a different type or non-sorted "same" word occurs) and, holding down ALT + SHIFT, draw with the mouse down through the end of that whitespace to the next (last of the presort) whitespace discontinuity. You don't need to pull the mouse through anything more that the first character of the block of data/word you wish to separate from the whitespace. Now hit TAB ... until you've moved the "block" (you'll see the entire right content move right) to where it aligns with the header to which you've chosen to justify it. Use SHIFT+TAB to, essentially, "undo" this move of the content block right.

Points of Interest

Being able to use the old selection rubberband (or marching ants as I've heard it referred to as) seemed like it would be an intuitive thing to be able to do in any text editing situation. I imagine that those who use Notepad quite often have been conditioned to accept this draconian idea of having to solicit space bar and tab space behaviors in order to get sequences of words into vertical alignment. There ain't no SHIFT+ALT blocking for selection available there. And to make a long story short, buying into a spreadsheet like Excel to solve this problem once it's encountered there in Notepad ... is just plain silly. Chicken/egg thing, right?

History

eftsoons ... Tip/Trick "ALT+SHIFT Edit", the first

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --