PC Review


Reply
Thread Tools Rate Thread

Convert tabs to spaces

 
 
Dion Starfire
Guest
Posts: n/a
 
      12th Jan 2008
Is there a way to convert a tab into however many spaces are needed to reach
the next tab stop?

I'm trying to convert an html table to a plain text file. Some of the cells
contain multiple lines. Currently, I copy into word, convert the table to
tab-delimited text, then save as plain text. However, this destroys the
column alignment, and messes up the multi-line 'cells'.

If there's not a built in function for this, how could I write a macro to do
this? (I'm at the 'dabbler' proficiency level, but am very good at using the
built-in help system).
 
Reply With Quote
 
 
 
 
JoAnn Paules
Guest
Posts: n/a
 
      13th Jan 2008
The number of spaces are going to vary depending on your font and font size.
Plain text tables *never* look as pretty as a table with formatting.

--

JoAnn Paules
MVP Microsoft [Publisher]

~~~~~
How to ask a question
http://support.microsoft.com/KB/555375


"Dion Starfire" <(E-Mail Removed)> wrote in message
news:96700121-9857-4586-ABA5-(E-Mail Removed)...
> Is there a way to convert a tab into however many spaces are needed to
> reach
> the next tab stop?
>
> I'm trying to convert an html table to a plain text file. Some of the
> cells
> contain multiple lines. Currently, I copy into word, convert the table to
> tab-delimited text, then save as plain text. However, this destroys the
> column alignment, and messes up the multi-line 'cells'.
>
> If there's not a built in function for this, how could I write a macro to
> do
> this? (I'm at the 'dabbler' proficiency level, but am very good at using
> the
> built-in help system).


 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      13th Jan 2008
What you are experiencing is inevitable and nothing to do with the plain
text nor the tabs. It concerns the fact that if you have multi-line cell
content, then that content will no longer be multi-line if you convert the
table to text (or save the document containing the table) as plain text. The
cell content opens out and displaces the remaining text, which would remain
tabbed. Frankly I don't see how a macro would be able to sort out such a
random mess.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Dion Starfire wrote:
> Is there a way to convert a tab into however many spaces are needed
> to reach the next tab stop?
>
> I'm trying to convert an html table to a plain text file. Some of the
> cells contain multiple lines. Currently, I copy into word, convert
> the table to tab-delimited text, then save as plain text. However,
> this destroys the column alignment, and messes up the multi-line
> 'cells'.
>
> If there's not a built in function for this, how could I write a
> macro to do this? (I'm at the 'dabbler' proficiency level, but am
> very good at using the built-in help system).



 
Reply With Quote
 
Dion Starfire
Guest
Posts: n/a
 
      13th Jan 2008
I could almost do this with a simple find and replace, if I could figure out
how to replace the tab with the required number of spaces (varies from line
to line, depending on length of content before tab).

After converting the table to text, the line from the multi-line cells end
with a manual line break, while each (formerly) cell rowends with a paragraph
mark.

So:
replace [character followed by tab] with X spaces, where x equals the
difference between the location of the tab character and the next tab stop.

replace [line break followed by tab] with a number of spaces equal to the
location of the tab (expressed in character columns)



"Graham Mayor" wrote:

> What you are experiencing is inevitable and nothing to do with the plain
> text nor the tabs. It concerns the fact that if you have multi-line cell
> content, then that content will no longer be multi-line if you convert the
> table to text (or save the document containing the table) as plain text. The
> cell content opens out and displaces the remaining text, which would remain
> tabbed. Frankly I don't see how a macro would be able to sort out such a
> random mess.
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> Dion Starfire wrote:
> > Is there a way to convert a tab into however many spaces are needed
> > to reach the next tab stop?
> >
> > I'm trying to convert an html table to a plain text file. Some of the
> > cells contain multiple lines. Currently, I copy into word, convert
> > the table to tab-delimited text, then save as plain text. However,
> > this destroys the column alignment, and messes up the multi-line
> > 'cells'.
> >
> > If there's not a built in function for this, how could I write a
> > macro to do this? (I'm at the 'dabbler' proficiency level, but am
> > very good at using the built-in help system).

>
>
>

 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      14th Jan 2008
Dion Starfire wrote:
> I could almost do this with a simple find and replace, if I could
> figure out how to replace the tab with the required number of spaces
> (varies from line to line, depending on length of content before tab).


And that's exactly the problem for any solution!

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spaces and tabs won't display Old Blind Dog Microsoft Word Document Management 3 26th Feb 2010 10:08 PM
Convert tabs to spaces =?Utf-8?B?QkVFSkFZ?= Microsoft Excel Programming 1 1st Mar 2007 07:45 AM
Convert Tabs to Spaces =?Utf-8?B?QkVFSkFZ?= Microsoft Excel Worksheet Functions 0 27th Feb 2007 09:20 PM
tabs and spaces =?Utf-8?B?TGl0dGxlX0ppbW15?= Microsoft Word Document Management 4 27th Jan 2006 07:09 PM
tabs 2 spaces *ProteanThread* Freeware 0 1st Feb 2005 09:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:18 AM.