Bug 104255 - Allow alphabetical sorting of headings
Summary: Allow alphabetical sorting of headings
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Extensions (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 148639 (view as bug list)
Depends on:
Blocks: Navigator
  Show dependency treegraph
 
Reported: 2016-11-29 14:38 UTC by chris.siller
Modified: 2022-05-06 06:51 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Sorting headings alphabetically - feature suggestion demo (20.65 KB, application/vnd.oasis.opendocument.text)
2016-12-04 12:56 UTC, chris.siller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description chris.siller 2016-11-29 14:38:34 UTC
I occasionally need to sort headings in alphabetical order (for instance, when I write documentation, I often have 1-5 paragraphs on a long list of keywords).

Right now, I always have to export to MS Word, sort headings there, then re-import to LO...


This functionality should be integrated into the Navigator (or the currently existing sort function should be extended so you can select format styles to sort by as 1st, 2nd, 3rd sort key)
Comment 1 chris.siller 2016-11-29 14:39:32 UTC
Here is how to sort by paragraph styles in MS Office:

http://word.tips.net/T000041_Sorting_by_Headings.html
Comment 2 Buovjaga 2016-12-02 08:29:00 UTC
(In reply to chris.siller from comment #1)
> Here is how to sort by paragraph styles in MS Office:
> 
> http://word.tips.net/T000041_Sorting_by_Headings.html

The page gives a fatal error. Any more reliable resource?
Comment 3 chris.siller 2016-12-02 15:41:14 UTC
(In reply to Buovjaga from comment #2)
> (In reply to chris.siller from comment #1)
> > Here is how to sort by paragraph styles in MS Office:
> > 
> > http://word.tips.net/T000041_Sorting_by_Headings.html
> 
> The page gives a fatal error. Any more reliable resource?

Here is the full text explaining how to sort headings alphabetically in MS Word:

************ START WEB SNIPPET ****************************
A useful trick you can use when developing some types of documents is the ability to sort the various parts of the document based on the headings you use. For instance, you can sort the document based on first-level headings (paragraphs that use the Heading 1 style) by following these steps:

1. Switch to Outline view. (Either click the Outline view button on the status bar or go to the View tab of the Ribbon and select Outline in the Views group.)
2. Using the controls on the Outlining tab of the ribbon, collapse the headings so that only the first-level headings are shown. (This step is not strictly necessary, but does make the screen a bit more readable.)
3. Place the cursor at the beginning of the first heading and press Ctrl+Shift+End to select everything through the end of the document.
4. Display the Home tab of the ribbon.
5. Click the Sort tool in the Paragraph group. Word displays the Sort Text dialog box. (See Figure 1.). Note: for versions earlier than Word 2003, the Sort tool is in the table menu.
6. Click on OK to accept the default settings in the dialog box.

Had you skipped the first two steps and performed the sort in any view besides Outline view, every paragraph would have been sorted alphabetically and therefore rearranged so that subordinate paragraphs would be separated from their headings. In other words, you would have a mess. However, in Outline view, the highest-level headings are sorted, bringing along the subordinate heading levels and body text.

If you wanted to sort by Heading 2 paragraphs, you should also use Outline view, but you would have to first select all the Heading 2 paragraphs subordinate to a particular Heading 1 paragraph and then sort. You will get the same results regardless of how many heading levels that you show on the Outline toolbar.

**********END WEB SNIPPET ************************

So in short, to sort headings in word, you switch to the outline view, then hide all levels in the hierarchy you do NOT want to have sorted, select all the entries and then use the sort tool.

More links with essentially the same procedure described:

http://superuser.com/questions/589303/how-to-sort-headings-in-word-2010

https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-mso_other/word-2010-sorting-a-z-for-a-sub-heading-and/96349042-aa06-4e19-91f3-a3acd75a2f7c
Comment 4 Heiko Tietze 2016-12-02 20:47:27 UTC
Duplicate of bug 101252?
Comment 5 Buovjaga 2016-12-03 19:20:43 UTC
(In reply to Heiko Tietze from comment #4)
> Duplicate of bug 101252?

Chris: do you agree with Heiko?

Set to NEEDINFO.
Change back to UNCONFIRMED, if you don't. Change to RESOLVED DUPLICATE of 101252, if you do.
Comment 6 chris.siller 2016-12-04 12:56:15 UTC
Created attachment 129300 [details]
Sorting headings alphabetically - feature suggestion demo
Comment 7 chris.siller 2016-12-04 12:59:15 UTC
I don't agree with Heiko about this being a duplicate - the linked bug/enhancement wants to sort the sequence of INDEX ENTRIES (that are made from Headings) alphabetically, while leaving the actual document flow untouched.

I am suggesting to add the ability to sort the sequence of the HEADINGS THEMSELVES in the document flow (not their index entries, as requested in the other bug).

In short, my suggestion is:

add a “Sort A→Z” button to the navigator, allowing people to arrange headings of a specific hierarchy level in alphabetical order. Ideally, this would be possible over multiple hierarchy levels (e.g. sort only headings 2, OR sort first heading 1 items alphabetcially, then underneath each heading 1, sort all headings 2 alphabetically).

Alternatively, the same functionality could be achieved by extending the existing Tools-Sort menu item to allow user to sort alphabetically by headings-paragraph style (while bringing along any lower-level text like text-body etc).

For an example when/how this would be useful, see attached file.
Comment 8 Heiko Tietze 2016-12-05 09:32:59 UTC
(In reply to chris.siller from comment #7)
> I am suggesting to add the ability to sort the sequence of the HEADINGS
> THEMSELVES in the document flow (not their index entries, as requested in
> the other bug).

Such a (automatic) sort feature is a very complicated thing. Your example sorts the second level but keeps the first heading, in other cases you may want to sort only the third level or do it independently from any level. And actually it is not the task of a word processor to generate structured text. If you start to collect Grimm's work you do it in a database and export the result eventually. Of course, sometimes it is necessary to sort headings but not automatically. To do so we have the Navigator (hopefully improved sooner than later https://design.blog.documentfoundation.org/2016/07/31/how-the-navigator-may-support-object-handling-in-libreoffice-draw/).

On the other hand the request makes sense in a few situations between the structured data approach with Base and the manual processing in Writer. So my recommendation is to have this feature as an extension. Changing the component accordingly.
Comment 9 Heiko Tietze 2020-01-20 12:23:34 UTC
You can "Send Outline to Clipboard" (context menu at the Navigator) put that into a table and sort.
Comment 10 Dieter 2022-05-06 06:51:21 UTC
*** Bug 148639 has been marked as a duplicate of this bug. ***