[Solved] Line numbering on left and right of page in Writer?
[Solved] Line numbering on left and right of page in Writer?
line numbering on left and right of page in Writer?
I want to create a document of a few hundred pages, where continuous line numbers appear on the left and right of the page. Below is an example of what I want to achieve (although I want to specify a different starting number than 1). How can I do this in writer? Can I do this natively, or is there a macro that would work?
I want to create a document of a few hundred pages, where continuous line numbers appear on the left and right of the page. Below is an example of what I want to achieve (although I want to specify a different starting number than 1). How can I do this in writer? Can I do this natively, or is there a macro that would work?
Last edited by Hagar Delest on Thu Jan 14, 2021 3:41 pm, edited 2 times in total.
Reason: tagged solved.
Reason: tagged solved.
OpenOffice 4.1.8 on Windows 10
Re: line numbering on left and right of page in Writer?
Cross posted at AskLibreOffice.
If you cross post, please note that you have done so, otherwise it leads to several discussions and a waste of time because several identical answers may be posted by different users.
If you cross post, please note that you have done so, otherwise it leads to several discussions and a waste of time because several identical answers may be posted by different users.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Re: line numbering on left and right of page in Writer?
I posted in both forums, as it is relevant to each program, and each program may have a different user base. I also have Open office and Libre office installed on my computer, so why not ask in both places? I have also not received a reply on either forum that fully answers my question, so why not ask in both places? Of course if I receive a reply that answers my question, I will update the threads.robleyd wrote:Cross posted at AskLibreOffice.
OpenOffice 4.1.8 on Windows 10
Re: Line numbering on left and right of page in Writer?
If you want the same numbering on every page you can use frames attached to the header (as in the attached document)
If you want different numbering on each you can have different frames attached to each page.
If you want different numbering on each you can have different frames attached to each page.
- Attachments
-
- frame in header.odt
- (9.38 KiB) Downloaded 139 times
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Line numbering on left and right of page in Writer?
Thank you JeJe for your reply, but how do I automatically fill those frames with numbers for every line (like line numbering). There are a few hundred pages, so it would be very tedious to do manually
OpenOffice 4.1.8 on Windows 10
Re: line numbering on left and right of page in Writer?
You should read all of robleyd's post, not just the first line. He adds an explanation and it's a good one. You don't want to waste the time of other people, so while it's okay to cross post, you should always add links to the other places where you post.tommydog wrote:I posted in both forums, as it is relevant to each program, and each program may have a different user base. I also have Open office and Libre office installed on my computer, so why not ask in both places? I have also not received a reply on either forum that fully answers my question, so why not ask in both places? Of course if I receive a reply that answers my question, I will update the threads.robleyd wrote:Cross posted at AskLibreOffice.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
Re: Line numbering on left and right of page in Writer?
A macro could be written to add numbers to frames and insert frames but you'll need to say more about what it is you want to add the lines to/post a sample. What's going to work will depend on what that is.
Another approach is given in the other thread. This similar macro will add the numbers at the beginning and end of the lines with the provisos:
There's no line wrapping
All the paragraphs have a right aligned tab positioned at the right margin
Edit: and there's room for the numbers
Another approach is given in the other thread. This similar macro will add the numbers at the beginning and end of the lines with the provisos:
There's no line wrapping
All the paragraphs have a right aligned tab positioned at the right margin
Edit: and there's room for the numbers
Code: Select all
Sub Main
vc = thiscomponent.currentcontroller.viewcursor
vc.gotorange (thiscomponent.text.start,false)
do
no = no+1
vc.gotostartofline false
vc.gotoendofline true
vc.string = no & vc.string & chr(9) & no
ret =vc.godown(1,false)
if ret = 0 then exit do
loop
End Sub
- Attachments
-
- sample.odt
- (11.12 KiB) Downloaded 123 times
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Line numbering on left and right of page in Writer?
Thinking a bit more, the best approach is possibly run this macro which puts numbers at the start of every line whether they're wrapped or not. And set the line numbering to right position, interval 1 for the right aligned numbers.
Edit: slightly simplified macro, added space after number
Edit2: reverted to earlier version with added space
Code: Select all
Sub Main
vc = thiscomponent.currentcontroller.viewcursor
vc.gotorange (thiscomponent.text.start,false)
do
no = no+1
vc.gotostartofline false
vc.gotoendofline true
vc.string = no & " " & vc.string
ret =vc.godown(1,false)
if ret = 0 then exit do
loop
End Sub
Edit2: reverted to earlier version with added space
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Line numbering on left and right of page in Writer?
The left can be done as usual or:
Anchor "images with the numbers" in the header or footer. They appear on every page.
Set a "blank background image with the numbers" to each page style.
Add a watermark with the numbers. Most printers allow it at printing too.
Anchor "images with the numbers" in the header or footer. They appear on every page.
Set a "blank background image with the numbers" to each page style.
Add a watermark with the numbers. Most printers allow it at printing too.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Line numbering on left and right of page in Writer?
Thank you for your help with this
OpenOffice 4.1.8 on Windows 10
Re: Line numbering on left and right of page in Writer?
Another probably very awkward method would be to use multiple columns. Either 3 columns or two plus normal line numbering.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Line numbering on left and right of page in Writer?
I don't think that will work because, when text from the centre column spills, it does not go to the next page centre column - it goes into the right column. Every edit or change would require the numbers to be adjusted - it wouldn't merely be awkward, it would be a nightmare.JeJe wrote:Another probably very awkward method would be to use multiple columns. Either 3 columns or two plus normal line numbering.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Line numbering on left and right of page in Writer?
John_Ha - yep... it would make no sense except once for a finished document needing no further editing. Same with the methods that add the numbers directly before and after in the main text.
Edit: the 3 column method could be combined with the frame one, having a single frame in the background for each page with both columns of numbers. The problem with the frame methods is if heights of lines vary it will be complicated matching that.
Edit 2
Or we could have one frame in the background for both lots of numbers without columns using the right aligned tab method.
Edit: the 3 column method could be combined with the frame one, having a single frame in the background for each page with both columns of numbers. The problem with the frame methods is if heights of lines vary it will be complicated matching that.
Edit 2
Or we could have one frame in the background for both lots of numbers without columns using the right aligned tab method.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Line numbering on left and right of page in Writer?
When you find one of those treasure it - they are a lot rarer than hens' teeth.JeJe wrote:John_Ha - yep... it would make no sense except once for a finished document needing no further editing.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Line numbering on left and right of page in Writer?
This is what I used in the end and it works great:
Code: Select all
Sub twoColNums
Dim i, s
Do
i = inputbox("How many lines you require?","Line Count")
s = inputbox("Starting number?","Starting number")
loop Until isNumeric(i) AND isNumeric(s)
Dim oText
oText = ThisComponent.Text
Dim n
s = cLng(s)
i = cLng(i)
For n = s To s+i
oText.insertString(oText.getEnd(), CHR$(13) & n & CHR$(9) & n , false)
Next n
Print "Done!"
End Sub
OpenOffice 4.1.8 on Windows 10
Re: Line numbering on left and right of page in Writer?
Ah... I see... you just wanted pages of the numbers not bounding any text... yeah that's easy.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: [Solved] Line numbering on left and right of page in Wri
I misunderstood too. If it's just the numbers needed:JeJe wrote:Ah... I see... you just wanted pages of the numbers not bounding any text... yeah that's easy.
1. Create the number sequence in adjacent columns a spreadsheet
2. Edit > Copy the range required
3. Edit > Paste special > Unformatted text .., into a text document.
All done.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.