Page 1 of 1

Macro to line up delimited Items?

Posted: Tue Aug 12, 2014 2:58 pm
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

Posted: Tue Aug 12, 2014 3:16 pm
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)

Posted: Tue Aug 12, 2014 3:19 pm
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".

Posted: Tue Aug 12, 2014 4:30 pm
by ak47wong
You can click View > Document Properties and change the width of the tabs, or define custom tab stops, on the Tabulation tab.

Posted: Fri Aug 15, 2014 9:54 pm
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

Posted: Tue Nov 18, 2014 6:32 pm
by MBKelly
http://forums.textpad.com/viewtopic.php?t=7093 provides a good method for vertically aligning text...

MBKelly