Justification

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
gcotterl
Posts: 255
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

Justification

Post by gcotterl »

When I copy cells whose contents are RIGHT-justified from an Excel spreadsheet and paste them into a TEXTPAD text-file, the contents become LEFT-justified.

What do I need to do so the pasted amounts are RIGHT-justified?
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

TextPad is a text EDITOR, not a word processor.

There are no justification options in TextPad.
Hope this was helpful.............good luck,
Bob
gcotterl
Posts: 255
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

justification

Post by gcotterl »

I was able to paste the amounts in my text file. However, I had to move the amounts around to get the decimal places to align.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Here is a possible tool for you. If the numbers are the only items on the line, then you might be able to use a RegEx to replace all leading spaces to a fixed number of spaces. This assumes all numbers are on the line with a decimal point and two decimals following, like this: nnn.xx, nnnn.xx

1. Assumes only one number on each line, no other data in front of the numbers.
2. All numbers have format of two decimals, no commas.
3. Remove all leading spaces

The example below is using "_" as a visible "space" character. First line inserts 5 spaces if there is only one number before the decimal. The second group inserts 4 spaces at the front of two leading digits. Each next group inserts a smaller number of leading spaces.

Search for: ^[0-9]{1}\.
Replace with:_____\0

Search for:^[0-9]{2}\.
Replace with:____\0

Search for: ^[0-9]{3}\.
Replace with:___\0

Search for: ^[0-9]{4}\.
Replace with:__\0

Search for: ^[0-9]{5}\.
Replace with:_\0

Run each search/replacement expression against the whole document, or the same selected section in the same order as shown above.

The result should be a column of numbers, aligned under decimal point with leading spaces. Adjust the number from 5 to whatever is needed, based on the length of the original numbers. Once aligned, you can use tools to increase/decrease indent amount.

If commas exist, you may need to modify the string to look for commas, dollar signs, or replace them completely. but this is a beginning point to start from.

Combine all of these RegEx replacements into a macro, assign a hotkey to the macro.
Hope this was helpful.............good luck,
Bob
Post Reply