Automated way to merge and remove hard returns in a column

E

Ed Sheehan

I have created a table from a report. One column has many words, which wrap
into several rows during 'convert text to table,' while all the other
columns could fit on one row, as shown in Fig. A. I would like to end up
like Fig. B, but It's a real PITA to do the merges and return-removals
manually. Anyone got a solution? I'm happy to massage the data externally if
necessary.

|COLUMN1 |COLUMN2 |COLUMN3 |
|----------|------------|----------|
|Few Words |Many many wo|Few Words |
|----------|------------|----------|
| |rds are in t| |
|----------|------------|----------| Fig. A
| |his column, | |
|----------|------------|----------|
| |and they hav| |
|----------|------------|----------|
| |e hard retur| |
|----------|------------|----------|
| |ns embedded | |
|----------|------------|----------|
| |for every ro| |
|----------|------------|----------|
| |w. | |
|----------|------------|----------|

=====================================================

|COLUMN1 |COLUMN2 |COLUMN3 |
|----------|------------|----------|
|Few Words |Many many wo|Few Words |
| |rds are in t| | Fig. B
| |his column, | |
| |and they hav| |
| |e hard retur| |
| |ns embedded | |
| |for every ro| |
| |w. | |

|----------|------------|----------|

Thanks, Ed
 
S

Suzanne S. Barnhill

Although there may be other ways to do this, I'd still do it the way you
have been. That is, convert the text to a table, then select all the rows
in Column B that belong together and merge them. Merge the corresponding
rows in A and C as well. Then use Find and Replace (see
http://word.mvps.org/FAQs/Formatting/CleanWebText.htm) to remove the
paragraph breaks. Even using column-select, I can't see any more efficient
way to handle it.
 
E

Ed Sheehan

Thanks, Suzanne. I was homing in on that as as solution as well, but there
was just too much work to it. So rather than use the built-in report
generator to produce the report, I wrote a program to print the data to the
screen in tab-delimited format with no column wrapping, then captured it.

I thought it might be safer to import to Excel first, because it's supposed
to handle columns/rows better (at least it has a better text-to-columns
filter).The w-i-d-e column went beyond 255 characters, and Excel filled
those cells with # characters. That was not a pleasant suprise.

So, in desperation I went directly into Word, thinking it would choke even
worse, and viola! It came in without a hitch. Text-to-tables formatted the
thing just as I had hoped. And it couldn't care less how much text was in a
cell! Who knew? :)

The lesson here is: If you want columns to auto-wrap, don't bring 'em in
with hard returns. And if you want one row per logical imported row, don't
bring 'em in with hard returns. This means one has to ensure that each
imported row has columns as wide as necessary to hold the data - not always
an easy thing to accomplish.

I still think it shouldn't be too hard to create some kind of filter to
parse columns/rows to see where to wrap/break them.

Thanks again,

Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top