Bug 93904 - Strange Behaviour of Fields->Document->Chapter->Level
Summary: Strange Behaviour of Fields->Document->Chapter->Level
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4.5.2 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Fields
  Show dependency treegraph
 
Reported: 2015-09-03 21:25 UTC by Stefan
Modified: 2023-02-26 02:20 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Behaviour-Check (11.05 KB, application/vnd.oasis.opendocument.text)
2015-09-03 21:25 UTC, Stefan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan 2015-09-03 21:25:10 UTC
Created attachment 118401 [details]
Behaviour-Check

- Enable headline for your page
- insert to the headline 2 ore more fields:
-- Document->Chapter->Chapter Name - with Level set to "1"
-- Document->Chapter->Chapter Name - with Level set to "2"
-- ..
- Experiment with chapters and subchapters on different pages

This is what i found:

1.) If there is no chapter at the given level, the value will be set from the next chapter "above".
2.) If a page starts with a chapter, alls fields with levels same or above will set with the name of this chapter.

1.) Please don't set a wrong name from a chapter with an unchoosed level
2.) Maybe it will be better you get the values from the chapters at the END of the Page, NOT THE START.

The actual behaviour make the feature mostly useless:
You can never use fields with different levels together (f.e. in a headline)
Comment 1 Buovjaga 2015-09-14 09:27:25 UTC
Confirmed by looking at attachment 118401 [details].

Headline = header.

Win 7 Pro 64-bit, Version: 5.0.1.2 (32-bit)
Build ID: 81898c9f5c0d43f3473ba111d7b351050be20261
Locale: fi-FI (fi_FI)

Version: 5.1.0.0.alpha1+
Build ID: 88c51cd55d1a9b29e62269c53b3923770253ab07
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-09-11_13:09:15
Locale: en-US (fi_FI)
Comment 2 QA Administrators 2016-11-08 11:04:03 UTC Comment hidden (obsolete)
Comment 3 sstory 2020-07-24 13:17:51 UTC
This problem still exists. I have a 66 page document full of various Header1, Header2, Header3 styles on pages. In the page Header I inserted
Document->Chapter Name (setting to level1) : Document->Chapter Name (setting to level2)

I find that on some pages it work exactly as expected. Example:

Page has a Heading1 of 
"Server Installation" then some text and a Heading2 like "Initial Configuration"

And in the header it shows
"Server Installation : Initial Configuration" (right justified), with a line under it. Looks great!

Then on the page that follows there is only a Heading1, so it duplicates the text and shows it for SomeText : SomeText

It would be better if there was a way to say, always show the last Header1, and show the : and Header2 stuff if found, else don't show it for that page.

Then on yet another page I have a Heading1 and Heading2, and it ignores the Heading2 and duplicates Heading1.  I am running version 6.4.4.2 on:
OS:     CentOS Linux release 7.8.2003 (Core)
Kernel: 3.10.0-1127.13.1.el7.x86_64 

As it stands I will have to either live with glitchy behavior, or only use Level 1, which is cool, but disappointing as I have always been used to doing that in Word, since 1992. I hope someone will manage to find and fix the issues.
Comment 4 LeroyG 2021-07-26 20:42:30 UTC
Present at:

Version: 7.2.0.1 (x86) / LibreOffice Community
Build ID: 32efc3b7f3a71cfa6a7fa3f6c208333df48656cc
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: es-MX (es_MX); UI: en-US
Calc: threaded
Comment 5 sdc.blanco 2022-01-27 12:20:09 UTC
(In reply to sstory from comment #3)
> I find that on some pages it work exactly as expected. 
> Then on the page that follows there is only a Heading1, so it duplicates the
> text and shows it for SomeText : SomeText
Your example inspired some investigation, see attachment in bug 147004, comment 5.
 
> It would be better if there was a way to say, always show the last Header1,
> and show the : and Header2 stuff if found, else don't show it for that page.
Possible workaround. Insert an empty Header2  (can also be inserted as hidden paragraph)
Comment 6 sdc.blanco 2023-02-26 00:36:21 UTC
I believe the general "rule" when using format "Chapter name" or "Chapter number and name" is:

     Show contents of the first immediately preceding paragraph that 
     has an outline level less than or equal to (≤) the number entered 
     in the "Level" spinbox.  (bug 147004, comment 11)

It appears that this rule is also what Stefan has discovered in his results 1.) and 2.)

Meanwhile attachment 118401 [details] seems to demonstrate a special corner case, where the rule seems to be:

      When a Chapter (document) field, with format "Chapter name" is inserted
      on the first page, then show the contents of the first 
      heading (with any outline level), regardless of what "level" is set 
      for the field.

This actual result happens if the field is in the Header (Stefan's case) or simply inserted at the beginning of a document.

That seems like a bug -- and maybe this ticket could be used for that particular case (if others can confirm).

Tested with:

7.2.7.2

and 

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: c41e872ed248f804249ecf4d65c4afc2e426e329
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win