#1
|
|||
|
|||
Add line numbers to end of each line
I have a word 2007 file having text in an Indian language (Hindi) containing line numbers on each line. About 12 pages. Some lines are bolded, some are italicized and others are colored. What I want is to sort text in Hindi first but retain the line numbers. This is not possible I guess since the numbers will remain at their place. Sorting of text is fine, though. The next best thing I can do is copy the text along with line numbers into wordpad and back to word, then sort the text. But this way, the sorting is done based on numbers and not text. Another thing I can do is to remove the line numbers from the start of each line and add the line numbers to end of each line, say in brackets. But doing this manually is extremely tedious. I am aware that this can be done easily in Linux/UNIX using the sed tool but even if I had Linux installed, and used sed to do this, I'd had to loose the formatting of my text. Is there anyway that I can do what I want in Word itself, without having to do it manually for each line? |
#2
|
||||
|
||||
You may be able to use a wildcard Find/Replace to swap the numbers and text but, without seeing the document with some representative content, I can't really say for sure.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Cross-posted at: http://www.techsupportforum.com/foru...ne-661573.html
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
Well I thought that cross-posting is only within a forum. I posted in the other one so as to get a reply just in case I didn't get here. Anyway, thanks for the etiquette link.
I was able to get some results by copy-pasting the content into Excel and then back into word, but this way it takes quite an effort to properly adjust the columns and cells etc. I'd like to know your method in detail, so I'm attaching the first page of the document here. Please see if your method works, and let me know. Thanks and Regards, Deboo |
#5
|
||||
|
||||
See attached.
As you were using list numbering, a different approach was required. 1. Delete the list numbering and insert a tab charcter at the end of the 1st numbered line. 2. Turn the contents into a two-column table, with tab separators to create an empty 2nd column 3. Apply the list numbering to the second column. It was a little more fiddly than that to get the layout correct, but the above covers the essentials.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Numbers at the end of each line is not the only thing I wanted to do. Once you do the text based sorting, the numbers remain as they were, before the sorting, making the numbers useless (as this is a list of songs on an MP3 DVD).
I'm attaching the file you sent, after sorting the text. See if you can do something so that the numbers also move along with the text when I do the sorting. You won't have the sorting available in Hindi unless you install the Indic language support I guess. Thanks for your valuable time. Kind Regards, Deboo |
#7
|
||||
|
||||
It would have been helpful if you had said at the outset what the requirements are. You can still use the same basic approach, though - just skip step 3 and, instead, run the following macro:
Code:
Sub Number() Dim i As Long With ActiveDocument.Tables(1) For i = 1 To .Rows.Count .Columns(2).Cells(i).Range.Text = i Next End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
line numbers, text manupulation, word2007 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trend Line | uhlersa | Excel | 0 | 05-10-2011 06:17 PM |
I indent second line and the first line indents, help. | DerekUD | Word | 1 | 05-06-2011 11:26 PM |
How to paste into another app without line numbers? | Moonf4 | Word | 1 | 04-18-2011 03:16 PM |
First line on page is truncated (top of line) | OwlCat1212 | Word | 0 | 02-14-2011 03:24 PM |
Line breaks at each line in Web text | ahazelwood | Word | 5 | 01-06-2011 02:37 PM |