Bug 160203 - Add ability to reference total number of list items
Summary: Add ability to reference total number of list items
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.5.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks:
 
Reported: 2024-03-14 18:53 UTC by William Friedman
Modified: 2024-06-21 10:30 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William Friedman 2024-03-14 18:53:56 UTC
Description:
At present, there is no way to insert the total number of elements of a list as a field variable. E.g.:

There are X examples, as per the following list:

1. A
2. B
3. C
4. D.

There is a kludge: Fields | Cross-references | Numbered Paragraphs, and insert a cross-reference to the current final element of the list. For this kludge to work, however, one must always make sure the current final element remains the final element, only ever inserting new elements before it, which forces manual adjustment by cutting and pasting the existing final element into a newly inserted list element.

In order to properly implement this, it would seem that lists, which are currently all lumped under Fields | Cross-references | Type: Numbered Paragraphs, would have to be individually named or numbered in order to be disambiguated so that their individual total number of elements could be displayed.

Steps to Reproduce:
1. Go to Fields | Insert Cross-references | Type: Numbered Paragraphs.


Actual Results:
No option to insert a reference to the total number of numbered paragraphs.

Expected Results:
An option to insert a reference to the total number of numbered paragraphs.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.5.2 (X86_64) / LibreOffice Community
Build ID: 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 1 Dieter 2024-04-07 11:00:02 UTC
William, thank you for your report. Just for clarificatio. Idea is, that you have a list of let's say 8 items (bullets, numbers, ...) and you want to insert a field, that displays numbers of items, correct? And if number of items increases or discreases, filed should be updated, correct?
=> NEEDINFO
Comment 2 William Friedman 2024-04-07 19:50:58 UTC
(In reply to Dieter from comment #1)
> William, thank you for your report. Just for clarificatio. Idea is, that you
> have a list of let's say 8 items (bullets, numbers, ...) and you want to
> insert a field, that displays numbers of items, correct? And if number of
> items increases or discreases, filed should be updated, correct?
> => NEEDINFO

Yes on all counts. But please note that it won't work just to implement a field that counts the total number of instances of list items, since they are currently all lumped together as if they're a single list. Individual lists would have to be identified somehow.
Comment 3 Dieter 2024-06-16 14:52:08 UTC
So let's ask design-team.
Comment 4 Heiko Tietze 2024-06-17 09:03:28 UTC
In other, generalized words you ask for a field "Paragraph Count" of a certain paragraph style. I think this is not gonna fly. Besides a missing definition in ODF I struggle with the basic concept of conditional variables that not exist yet. Ultimately it sounds like a niche use case (actually missing that) and rather suited for a macro.
Comment 5 Heiko Tietze 2024-06-20 08:11:35 UTC
No further comment, resolving WF. Feel free to reopen.
Comment 6 William Friedman 2024-06-20 16:59:06 UTC
(In reply to Heiko Tietze from comment #4)
> In other, generalized words you ask for a field "Paragraph Count" of a
> certain paragraph style. I think this is not gonna fly. Besides a missing
> definition in ODF I struggle with the basic concept of conditional variables
> that not exist yet. Ultimately it sounds like a niche use case (actually
> missing that) and rather suited for a macro.

My apologies for responding a few days late. I believe this should be reopened.

1) Regarding the use case, I gave my own example in the initial report. For others, see:
https://superuser.com/questions/166953/ms-word-reference-to-highest-number-in-a-numbered-list
https://stackoverflow.com/questions/17315743/how-to-count-the-items-within-bulleted-list-vsto-word-2007

2) I understand that implementing this may require adding definitions to the ODF format, but I don't see the issue with "conditional variables that [do] not exist yet." That is the very nature of an enhancement request. It may make the request less likely to be fulfilled (there are, certainly, many requests of more necessary features that have gone unfulfilled for over a decade), but WONTFIX implies that the request is somehow fundamentally invalid, which is a judgment I don't understand. The ability to reference the number of elements of individual lists just seems like a basic function, even if its implementation is difficult.

Thank you for your reconsideration.
Comment 7 Heiko Tietze 2024-06-21 10:30:16 UTC
(In reply to William Friedman from comment #6)
> https://superuser.com/questions/166953/ms-word-reference-to-highest-number-
> in-a-numbered-list
> https://stackoverflow.com/questions/17315743/how-to-count-the-items-within-
> bulleted-list-vsto-word-2007

Comments indicate that MSO does not provide this information too. You can also use a macro in LibreOffice.

But I think you mistakenly think of a list as some countable structure. The list is just a number of paragraphs with a common attribute (list style) and something like

<li1>Text 1
<li1>Text 2
Text 3
Text 4
<li1>Text 5
Text 6
<li2>Text 7
<li2>Text 8

is quite difficult to count. Perhaps you succeed with a table?