I have searched extensively, but I have not been able to find advice on how to select a range of pages in Writer.
I have many documents that are several hundred pages long. Sometimes, when I am editing sections of a document, I want to select, say, pages 35-68, then copy and paste that material elsewhere. Is there any way to do this other than manually?
[Solved] Selecting a range of pages in Writer
[Solved] Selecting a range of pages in Writer
Last edited by Hagar Delest on Thu Mar 22, 2018 9:16 am, edited 1 time in total.
Reason: tagged solved
Reason: tagged solved
OpenOffice 4.1.5 on Windows 10
Re: Selecting a range of pages in Writer
In Writer, look up the Help file. On its Index tab enter "Selection modes in text" (no quotes) to find the different methods of making an extended selection.
You can also use Navigator to move Chapters up or down - see "Navigator;heading levels and chapters" in Help.
In my own work I always place each Chapter in its own OO Section; then they may easily be moved about.
You can also use Navigator to move Chapters up or down - see "Navigator;heading levels and chapters" in Help.
In my own work I always place each Chapter in its own OO Section; then they may easily be moved about.
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
Re: Selecting a range of pages in Writer
To get what literally was asked for there is no built-in tool, I'm afraid.
If the functionality is urgently needed I can only think of a few lines of user code for the purpose. The "macro" might be placed in a module of the 'Standard' library of the user's own container ('My Macros') and assigned to a toolbar item by 'Customize'. I personally surely don't need that, but I wrote related code as a finger exercise to learn a bit more about text-/viewcursors. It's free:
If the functionality is urgently needed I can only think of a few lines of user code for the purpose. The "macro" might be placed in a module of the 'Standard' library of the user's own container ('My Macros') and assigned to a toolbar item by 'Customize'. I personally surely don't need that, but I wrote related code as a finger exercise to learn a bit more about text-/viewcursors. It's free:
Code: Select all
Sub selectConsecutivePages() '(pNum is the effective parameter, here set with InputBox.)
' See also the comments at the end!
' Conversion to number needed for pNum!
pNum = CLng(InputBox(Chr(10) & Chr(10) & Chr(10) & Chr(1) & Chr(10) & Chr(10) _
& "Number of pages: ", "Prompt for number of pages"))
tVC = ThisComponent.CurrentController.GetViewCursor()
tVC.JumpToStartOfPage(False)
hTC = tVC.Text.CreateTextCursorByRange(tVC)
For k = 1 To pNum
tVC.JumpToEndOfPage()
tVC.GoRight(1,False)
Next k
hTC.GotoRange(tVC.End, True)
tVC.GotoRange(hTC.End, False)
tVC.GotoRange(hTC.Start, True)
End Sub
' Including the start page pNum pages are assigned as the range to a TextCursor.
' There is no check if actually pNum pages were available from the starting position.
' No error will be reported if only less pages were selectable.
' The ViewCursor is subsequently set to the range of the TextCursor.
' This way you have the choice to proceed with the TextCursor or (.e.g.)
' to Copy the range covered by the ViewCursor.
' I would assume that only in the second case also elements handled by the DrawPage
' (Shapes of many kinds) will be copied. No complete research so far!
' Setting the original .Start as the logical .End of the new ViewCursor range allows to
' return to where you were in advance by a simple left/right e.g.On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: Selecting a range of pages in Writer
Wow, thank you both for the help, and for the code above! This is great and incredibly helpful.
OpenOffice 4.1.5 on Windows 10
Re: Selecting a range of pages in Writer
Glad if the code helps, but:
Please stay aware of the fact that I neither from any specification nor from own research know how the Sub will act in slightly "uncommon" situations. The upper or lower border of the page range may cut through a text section or through a text table e.g. What about OLE objects? In adition there are surely special situations I didn't think of yet.
Please stay aware of the fact that I neither from any specification nor from own research know how the Sub will act in slightly "uncommon" situations. The upper or lower border of the page range may cut through a text section or through a text table e.g. What about OLE objects? In adition there are surely special situations I didn't think of yet.
On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: Selecting a range of pages in Writer
It came to me later that another way to do this - crude but effective - is to Save the entire file under another name, say "Selection"; click cursor at the start of the selection you wish to save, and press backspace key - hold it down. It will start to delete text before your selection until it comes to the start of the file. Now click cursor at end of the desired selection, and hold down Delete key. It will delete text from the end of selection to the end of the file. Now you are left with the selection, which comprises the content of the "Selection" file,
You can speed this process by selecting text before (or after) the selection area, and pressing delete or backspace, deleting on larger chunks, always working away from the desired selection area.
You can speed this process by selecting text before (or after) the selection area, and pressing delete or backspace, deleting on larger chunks, always working away from the desired selection area.
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
Re: [Solved] Selecting a range of pages in Writer
There is a way as follows :-
'click' your cursor at the start point of what you want to delete.
now scroll down to the end point of what you want to delete
and press 'shift' + 'click' instead.
this should highlight all content from the initial cursor click to the second click.
now delete the selection ..... BUT
my delete button on my laptp didnt work.
AND when i right clicked the highlighted area there was no delete option on my version of OO 4.1.13
(nor under edit menu either. i have never noticed this)
so i used 'cut' from the right click menu instead..... but remember that this will put potentially huge amounts of data in your clipboard.
On my laptop it took a few seconds to highlight the text between 'click' and then 'ctrl'+'click'. Maybe this is a sort of clipboard too? After all there is the undo function.
you could try 'ctrl'+'y' instead of 'cut', because that is a short cut to delete.
anyway i deleted over 400 pages using this method.
'click' your cursor at the start point of what you want to delete.
now scroll down to the end point of what you want to delete
and press 'shift' + 'click' instead.
this should highlight all content from the initial cursor click to the second click.
now delete the selection ..... BUT
my delete button on my laptp didnt work.
AND when i right clicked the highlighted area there was no delete option on my version of OO 4.1.13
(nor under edit menu either. i have never noticed this)
so i used 'cut' from the right click menu instead..... but remember that this will put potentially huge amounts of data in your clipboard.
On my laptop it took a few seconds to highlight the text between 'click' and then 'ctrl'+'click'. Maybe this is a sort of clipboard too? After all there is the undo function.
you could try 'ctrl'+'y' instead of 'cut', because that is a short cut to delete.
anyway i deleted over 400 pages using this method.
openoffice 4.1.13 on windows 10