Extend LAST line of paragraph in TOC
-
- Posts: 2
- Joined: Mon Feb 03, 2025 9:42 am
- Location: Somewhere in the tayga
Extend LAST line of paragraph in TOC
Namaste!
My short question is "how to extend the LAST line of a paragraph?" I think this is what I want to do. Or maybe better to rephrase it as "how to shrink all lines of a paragraph except for the last one?"
Application: My thesis paper has to have a table of contents, where the titles, which may end up wrapping around to the next line, shouldn't extend to the right margin, whereas only the page numbers are on the right margin. Therefore, the recommended way (recommended by the school) is to hand-create the table of contents in a two-column table, with all entries manually made... I think you can get the idea: titles in the left column and page numbers hand-aligned in the right column.
Since I'm really rather scatter-brained, an automatic option would work the best, I'm hoping to just assign the correct style to the entries in the table of contents, and let the program do the rest. But I don't see how to do this, even after reading on the web.
Attached are two pictures, one which is the way they want it, and one is what I'm getting out for my work. Also, I have no idea why the table of contents, generated by Writer, is on a grey background.
My short question is "how to extend the LAST line of a paragraph?" I think this is what I want to do. Or maybe better to rephrase it as "how to shrink all lines of a paragraph except for the last one?"
Application: My thesis paper has to have a table of contents, where the titles, which may end up wrapping around to the next line, shouldn't extend to the right margin, whereas only the page numbers are on the right margin. Therefore, the recommended way (recommended by the school) is to hand-create the table of contents in a two-column table, with all entries manually made... I think you can get the idea: titles in the left column and page numbers hand-aligned in the right column.
Since I'm really rather scatter-brained, an automatic option would work the best, I'm hoping to just assign the correct style to the entries in the table of contents, and let the program do the rest. But I don't see how to do this, even after reading on the web.
Attached are two pictures, one which is the way they want it, and one is what I'm getting out for my work. Also, I have no idea why the table of contents, generated by Writer, is on a grey background.
- Attachments
-
- Снимок экрана от 2025-02-03 16-02-46.png (27.92 KiB) Viewed 6519 times
-
- Снимок экрана от 2025-02-03 16-03-38.png (31.48 KiB) Viewed 6519 times
OpenOffice 7.4.2.7 on Debian 4:7.4.7-1+deb12u6
- Hagar Delest
- Moderator
- Posts: 33384
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: How to extend LAST line of paragraph?
Hi and welcome to the forum!
The gray background is not printed, you can check it with the print preview. You can change that with the menu Tools > Options > OpenOffice > Application colors (at least with LibreOffice).
Doing a manual ToC rather defeats the point of the feature.
But you can use cross reference i nthe 2nd column of your table. You'll have to do the alignment manually (standard ToC without the page numbers in the first one and the cross references to the page numbers in the 2nd).
Please add [Solved] at the beginning of the title in your first post (top of the topic) with the ✎ button if your issue has been fixed.
The gray background is not printed, you can check it with the print preview. You can change that with the menu Tools > Options > OpenOffice > Application colors (at least with LibreOffice).
Doing a manual ToC rather defeats the point of the feature.
But you can use cross reference i nthe 2nd column of your table. You'll have to do the alignment manually (standard ToC without the page numbers in the first one and the cross references to the page numbers in the 2nd).
Please add [Solved] at the beginning of the title in your first post (top of the topic) with the ✎ button if your issue has been fixed.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
Re: How to extend LAST line of paragraph?
In OpenOffice the shading can be turned off/on by /View /Field shadings. It is non printing.
I'd hand edit the ToC, inserting Line Breaks (Shift Enter) where necessary, say before the B character in Item 2 of the example. Such hand edit of a ToC is best left until the document is complete.
I'd hand edit the ToC, inserting Line Breaks (Shift Enter) where necessary, say before the B character in Item 2 of the example. Such hand edit of a ToC is best left until the document is complete.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
-
- Posts: 2
- Joined: Mon Feb 03, 2025 9:42 am
- Location: Somewhere in the tayga
Re: How to extend LAST line of paragraph?
Bonjour mes amis M Hägar and Mr. RoryOF, Dia daoibh! Thank you for your replies! Hopefully, someone knows how to do what I want, but this is *nearly* solved. I'll wait just a bit longer!
Happy Winter!
Happy Winter!
OpenOffice 7.4.2.7 on Debian 4:7.4.7-1+deb12u6
Re: How to extend LAST line of paragraph?
Would this work?
The caret isn't visible in the third table selection, but its taken to the top of the table to include the line end marks. Then the paste is made at the top of the second column.
Edit:
You can right align the second column - not done.
Edit 2:
The Paste Special is as Unformatted text
The caret isn't visible in the third table selection, but its taken to the top of the table to include the line end marks. Then the paste is made at the top of the second column.
Edit:
You can right align the second column - not done.
Edit 2:
The Paste Special is as Unformatted text
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
- Hagar Delest
- Moderator
- Posts: 33384
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: How to extend LAST line of paragraph?
The problem is that you lose the hyperlinks and it will not update if the pagination changes because you add or remove some pages.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
Re: How to extend LAST line of paragraph?
The idea was to update the TOC, which could be hidden, and copy it over again.Hagar Delest wrote: ↑Mon Feb 03, 2025 4:45 pmThe problem is that you lose the hyperlinks and it will not update if the pagination changes because you add or remove some pages.
The table of contents, without a header, can be put inside the first column of a table and the same method, BLK select used to copy the numbers to the second column. It looks difficult to access the TOC if inside a table though - the right click menu in OO is the table menu, not the one for the TOC.
Alternatively the TOC could be put in a frame where this problem doesn't occur, and another frame could be alongside for the numbers.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Extend LAST line of paragraph in TOC
If the following is what you want (not sure if the .... dots are?) then here's a macro to implement converting the lines without numbers to paragraphs with a bigger right margin (i.e. to shorter lines).
Code: Select all
Sub FixTOC
dim vc,nc,tc
on error goto EXITTOC
vc = thiscomponent.currentcontroller.viewcursor
if isempty(vc.documentindex) then
MSGBOX "PLACE CURSOR IN DOCUMENT INDEX"
exit SUB
END IF
tc = vc.text.createtextcursorbyrange( vc.documentindex.contentsection.anchor)
TC.GOTORANGE( vc.documentindex.contentsection.anchor.END,TRUE)
TC.paraRightMargin = TC.paraRightMargin +2000
vc.gotorange(tc.start,false)
vc.gotorange(tc.START,false)
do
ret =vc.godown(1,false)
if ret = 0 then exit do
if isempty(vc.documentindex) then exit do
vc.gotoSTARTofline(FALSE)
vc.gotoendofline(TRUE)
NC = vc.text.createtextcursorbyrange(VC.END)
if NC.isendofparagraph = false then
NC.string = chr(13)
VC.GOTORANGE(NC,FALSE)
else
NC.paraRightMargin = NC.paraRightMargin -2000
end if
loop
EXITTOC:
End Sub
- Attachments
-
- MACRO FIX.jpg (67.77 KiB) Viewed 6166 times
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
- Hagar Delest
- Moderator
- Posts: 33384
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: Extend LAST line of paragraph in TOC
I'm wondering: I guess it has to be launched after the ToC has been updated and it is the equivalent of a manual edition. Then, if a line ends within the "blank" range, it will become a 2-line entry (instead of a single one), thus adding a line to the ToC. If such line addition makes the ToC grow bigger and add a new page, won't the page numbers be off by 1 (at least)?
Just nitpicking, it might be a corner case but who knows (especially for long documents).
Just nitpicking, it might be a corner case but who knows (especially for long documents).
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE Faye) and 24.8 portable on Windows 11.
Re: Extend LAST line of paragraph in TOC
@Hagar Delest
That's a good point. If manual or coded changes to the TOC are going to change the page numbers because of increased size of the TOC then space has to be reserved for the expansion of the TOC such as by page breaks.
That's a good point. If manual or coded changes to the TOC are going to change the page numbers because of increased size of the TOC then space has to be reserved for the expansion of the TOC such as by page breaks.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)