Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to paste a column of data into a table from a web page. The data contains dashes, for example:

TEST-1

TEST-2

TEST-3

When I select and paste this in to a Word 2007 table, it splits on the dash, which I do not want. Is there any way to suppress this?

share|improve this question
1  
Do you highlight the columns to paste in the data? Or do you click on the first cell and paste? –  admintech Sep 26 '12 at 14:38
    
I highlight the column I want. It's pasting from a text file, so if I do not highlight the column it won't split across the rows properly. –  Greg Reynolds Sep 26 '12 at 14:52

4 Answers 4

You can right mouse click in the cell and under "Paste Options" choose "Keep Text Only" (it looks like a clipboard with the letter 'A').

share|improve this answer
    
That did not work, I do not see that option. Perhaps it's only in 2010. –  Greg Reynolds Sep 26 '12 at 15:44

The example contains no dashes but HYPHEN-MINUS U+002D characters. Word treats them as allowing line break after them. This formally complies with general line breaking rules. Anyway, the break probably happens because the column width is too narrow for the entire expression. Increase the width or change the column formatting rules of the table (e.g., select the cells of the column, right click, select table settings, and go to cell settings an uncheck the checkbox that allows line wrapping).

share|improve this answer

I believe what you want to do is make hyphens behave as if they were ordinary characters (letters, digits, or other punctuation marks), so, for example,

   The quick brown fox jumps over the lazy well-fed dog.

will render as

|  The quick brown fox jumps over the lazy         |
|  well-fed dog.                                   |

rather than

|  The quick brown fox jumps over the lazy well-   |
|  fed dog.                                        |

In other words, you want nonbreaking hyphens.  <edit>If this isn't what you want, please clarify what you want.</edit>  MS Word will give you a nonbreaking hyphen if you type Ctrl+Shift+-.  (You may also see this documented as Ctrl+Shift+_.)  The obvious solution is to do a Find and Replace and change all ordinary hyphens in your table to nonbreaking hyphens.

Unfortunately, the Find and Replace dialog box doesn’t seem to allow you to enter nonbreaking hyphens.  Fortunately, you can do it semi-manually.  (You will have to decide whether this is feasible, based on the size of your table.)

  1. First, paste your text into Microsoft Word (i.e., into your table).
  2. In Microsoft Word, type Ctrl+F, -, Enter, and Esc.  In other words, search for the first hyphen in the table.
  3. Type Ctrl+Shift+- to replace it with a nonbreaking hyphen.
  4. Type Shift+ to select it (or do it with the mouse) and type Ctrl+C to Copy it (or do it with the mouse; i.e., the Copy button or the right-click menu).
  5. Type Shift+F4 to find the next hyphen.
  6. Type Ctrl+V to Paste the nonbreaking hyphen from the Clipboard (or do it with the mouse; i.e., the Paste button or the right-click menu).
  7. Repeat steps 4 and 5 until you have found (and replaced) all the hyphens in your table.

Perhaps one of our VBA wizards will be able to automate this, or somebody will know a workaround for the Find and Replace dialog box defect.

share|improve this answer
    
@Greg: You say, “I was pasting out of a text file, so I have no idea how to make a non-breaking hyphen in that.” in your answer. I never meant to suggest that you should. I’ve edited my answer (above) in an attempt to clarify it. –  Scott Sep 28 '12 at 15:40

Unfortunately none of these suggestions worked - the columns were wide enough etc. I was pasting out of a text file, so I have no idea how to make a non-breaking hyphen in that.

Anyway, the solution I came up with is very poor, but it did work

  1. Find / replace - with _ in my text file

  2. Copy / paste into my table

  3. Select the column, then find / replace _ with -

This did not break into columns, and left me with my original text.

share|improve this answer
    
I just tried this in my copy of Microsoft Word 2007, and it didn’t solve the problem that I understood you to mean from your original question — but I don’t know what you mean by “This did not break into columns”, so perhaps I misunderstood what you wanted. –  Scott Sep 28 '12 at 15:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.