Macro to line up delimited Items?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
g00ber
Posts: 10
Joined: Fri Jul 11, 2003 8:01 pm

Macro to line up delimited Items?

Post by g00ber »

Hi,
Is there any macro that can line up delimited data for easier viewing? Excel import is too cumbersome.

Ex: Orginal File

Code: Select all

PET,FRUIT,COLOR,SHAPE
Dog,Lemon,Red,Triangle
Cat,Lime,Blue,Circle
Bird,Orange,Yellow,Square
Desired Output

Code: Select all

PET   ,FRUIT   ,COLOR   ,SHAPE
Dog   ,Lemon   ,Red     ,Triangle
Cat   ,Lime    ,Blue    ,Circle
Bird  ,Orange  ,Yellow  ,Square
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

You can insert tab characters before each comma with the Replace command:

Find what: ,
Replace with: \t,
Select Regular expression.
Click Replace All.

When you want to restore the original text, delete the tabs:

Find what: \t
Replace with: (nothing)
g00ber
Posts: 10
Joined: Fri Jul 11, 2003 8:01 pm

Post by g00ber »

I would prefer something where it takes the biggest data in the column and use that as the "column-width".

Replacing commas with tabs doesn't really line it up if one of data is "big" and others are "small".
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

You can click View > Document Properties and change the width of the tabs, or define custom tab stops, on the Tabulation tab.
g00ber
Posts: 10
Joined: Fri Jul 11, 2003 8:01 pm

Post by g00ber »

Too much manual work to track the "biggest" data for each column.

I was looking for something like this
http://www.ultraedit.com/support/tutori ... files.html where it scans all the data and it decides the "biggest" data
MBKelly
Posts: 1
Joined: Tue Nov 18, 2014 1:43 pm

Post by MBKelly »

http://forums.textpad.com/viewtopic.php?t=7093 provides a good method for vertically aligning text...

MBKelly
>^,,^<
Post Reply