Bug 148290 - Can't get heading definition to take effect
Summary: Can't get heading definition to take effect
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.2.2 release
Hardware: All Linux (All)
: low minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-31 11:58 UTC by Luke Kendall
Modified: 2022-04-09 14:50 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Short sample document showing the problem (12.69 KB, application/vnd.oasis.opendocument.text)
2022-03-31 11:58 UTC, Luke Kendall
Details
ANother example document to reproduce the problem (8.52 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-04-08 11:46 UTC, Luke Kendall
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kendall 2022-03-31 11:58:06 UTC
Created attachment 179234 [details]
Short sample document showing the problem

Version: 7.2.3.2 / LibreOffice Community
Build ID: d166454616c1632304285822f9c83ce2e660fd92
CPU threads: 8; OS: Linux 5.16; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

See short attached document.

The heading style "Chapter Title" does not work: the style does not format the paragraphs given that style according to the paragraph definition.
They should all appear as "Chapter <N> - <words>" but they don't.

When I changed the heading style for the chapter titles, most of them failed to take effect in the document. I've prepared a short sample document that shows the problem.

The numbering style usually doesn't apply at all; the "before/after" text around the number usually doesn't appear. Sometimes "before/after" text appears that I have not defined (no "before", "after" = ":").
 
The effects seem to vary between examples.  Clearing direct formatting doesn't help.

I have no workaround to make the headings correct.

This is looking like a showstopper for me.  I wonder if https://bugs.documentfoundation.org/show_bug.cgi?id=127855 has somehow happened to some or most of my chapter titles?

Even if 127855 explains it, it's a serious bug that LO has no way to discover that (error? corruption?) via the UI, and no way to correct it.

That's how it looks to me: I'd be delighted if there is some workaround I could use to correct my problem.
Comment 1 Timur 2022-03-31 12:43:46 UTC
Major? This doesn't qualify as a bug yet. 
I don't see what exactly is the issue here, what you did and what doesn't work.
Seems so far like a stuff for Ask.LibreOffice.org, not bug report.
Comment 2 Luke Kendall 2022-03-31 12:52:00 UTC
(In reply to Timur from comment #1)
> Major? This doesn't qualify as a bug yet. 
> I don't see what exactly is the issue here, what you did and what doesn't
> work.
> Seems so far like a stuff for Ask.LibreOffice.org, not bug report.

The chapter headings should all be:

Chapter 1 - blah blah
Chapter 2 - other blah
Chapter 3 - whatever

Actual result:

Random choice, but number usually doesn't appear, and the word Chapter doesn't appear, and separator doesn't appear.

In other words, the paragraph style does not apply, and there seems to be no way to make it apply.
Comment 3 QA Administrators 2022-04-01 03:40:49 UTC Comment hidden (obsolete)
Comment 4 Luke Kendall 2022-04-01 04:21:26 UTC
I had a hunt around asklibreoffice and found this:
https://ask.libreoffice.org/t/heading-numbering-not-following/27538
It does seem like it may be a design error: allowing you to select an option in the paragraph style which will prevent the numbering you define from applying.
I'll investigate further on my end and add to this when I've done so.
Comment 5 Timur 2022-04-01 06:41:35 UTC
(In reply to Luke Kendall from comment #2)
> The chapter headings should all be:
> Chapter 1 - blah blah
> Chapter 2 - other blah
> Chapter 3 - whatever

I understood that, but not what you did to make it. 
I set Needinfo until you see and test that Ask, probably there's more.
Comment 6 Luke Kendall 2022-04-01 07:10:19 UTC
Okay, so it's a definite bug, but I doubt it's going to be reproducible.  Here's what happened.

The bug occurred because I created a new paragraph style based on Heading 1, called Chapter Title.
I changed the Outline & List's Apply List Style to WWNum3 and then did Edit Style of WWNum3:
In its Customize tab I made sure the Level was 1, Number was 1,2, 3, ...; Before: was set to "Chapter ", After: was set to " <emdash> ", saw the Preview looked correct, and hit OK.
In the Paragraph Style panel I also hit OK.
I did a Find & Replace and Find All to change all Heading 1 paragraphs to Chapter Title.
A minority of such paragraphs formatted correctly. Most appeared without the Before: or After: text included. Most had no numbering applied at all.
I copied the text into a new file, removed the bulk of it, checked the Paragraph Style of Chapter Title was defined as I wished, and then in the sample document confirmed that the same problem occurred.
I did Update Index on the TOC and saw the erroneous chapter title text reproduced in the TOC, so that was consistent.

Today I opened the sample document and saw the Chapter Title paragraph style was set to Apply List Style = None. That was very strange, as that was definitely not what it was set to when I saved it.  I changed the style back to what it had been when I saved it: WWNum3. The chapter titles all changed to be correctly numbered and correct text included.

The still-open original document still had the same errors as reported here. I confirmed that the Apply List Style and its settings were set as I wanted, just as described above. I tried changing Apply List Style to None: it made no difference. I changed it to WWNum3: it made no difference.  I changed it back to None.

I then closed the file and reopened it, without exiting Writer.

I changed the Apply List Style back to WWNum3, and then all the chapter headings changed to the correct values, matching what I had set it to.

So Writer got into some strange state where the paragraph style would not take effect, but closing the file and reopening it, after changing the Apply List Style to None, and then to what you want, is a workaround for the bug, so I can get the result I need.
I've changed the bug to Normal from Major as a result.

I suspect it will be extremely difficult to reproduce or track down this bug, but at least this report will record it and how to work around it if it happens to someone else.

Hope this extra detail helps. Thanks for clarifying what info you needed.

Note that in the AskLibreopffice link, above, it refers to "Outline & Numbering" for what is now called "Outline & List".
Comment 7 Luke Kendall 2022-04-02 06:20:39 UTC
In another document I just had a similar problem, where I made a change to a paragraph style, but the document would not update to reflect the changes.
In this new case, I had changed the Text Body style, and changed Text Body Indent which inherited from that.
The changes to Text Body were to the font, the line spacing, justification, first line indent, and paragraph spacing.
I linked next style from Text Body to be Text Body indent.
I changed Text Body Indent in Organizer tab to Auto Update.
None of the changes to Text Body Indent applied. Even clearing all direct formatting made no change to any of the style changes I'd made to Text Body.

I closed the file and reopened it, and all paragraphs were displayed according to what the paragraph style defined.

Hope this helps.
Comment 8 Luke Kendall 2022-04-02 06:35:41 UTC
Yes, same workaround needed on the next file I'm working on, for chapter titles.

A key step was to make all the changes, creating the new paragraph style.

The changes would not take visible effect until I:
1. Changed the numbering style for the chapter titles to No numbering,
2. Saved the file and closed it.
3. Opened it again
4. Changed the numbering style from No Numbering to WWNum3
5. Saved and closed the file
6. reopened it.
All chapter titles then displayed correctly, matching the definition I'd given for the new Heading level 1 paragraph style.
Comment 9 Timur 2022-04-04 09:14:29 UTC
There's too much text here obscuring the issue, starting from the wrong report over a history to a fix of just applying the style.

Problem seems to be that List style wasn't saved:
> I opened the sample document and saw the Chapter Title paragraph style was set 
> to Apply List Style = None. I changed the style back to what it had been when 
> I saved it: WWNum3. The chapter titles all changed to be correctly numbered

Bug seems to say that style change is not immediately displayed.
 
But bug report was also incorrect on another point: reporter skipped bug report form that specifically asks if bug is reproducible. 
So I set back Needinfo for a clear, short and reproducible steps, like from comment 7 but with document before changes and listing those that don't apply.
Comment 10 Luke Kendall 2022-04-08 11:46:56 UTC
Created attachment 179413 [details]
ANother example document to reproduce the problem

Another short example document to reproduce the problem again.

Steps to reproduce:

1. Open the document
2. Click into Table of Contents
3. Choose Update index

Results:

None of the Chapter Title headings, which are defined to be heading level 1, appear.

Expected Results:

All the chapter headings should appear in the table of contents.
Any update of the TOC fails to include the level 1 headings.

I have no workaround for this.

The file was produced by taking a .odt file with working table of contents and saving as .docx file type.
Comment 11 Luke Kendall 2022-04-08 12:07:38 UTC
I found a workaround is to open Writer's .docx file in OnlyOffice, use it to add Chapter Title to the ToC and update it, and save the file.

If you then open that .docx in Writer, the ToC updates.
Comment 12 Timur 2022-04-08 12:26:04 UTC
Last example is the same as bug 138419 I closed as NAB.
Let's stop this. Please don't use BZ as a help tool, it's not, rather use ASK.
Comment 13 Luke Kendall 2022-04-08 12:28:26 UTC
I'm not using it as a help tool. I'm using a lot of time to report bugs.

I think I'll give up on LibreOffice, and switch to Only Office.

Thanks.
Comment 14 sdc.blanco 2022-04-08 12:30:04 UTC
(In reply to Luke Kendall from comment #10)
> I have no workaround for this.
Using "Another example..." attachment:

Method 1:

1. Place cursor in TOC, right-click, choose "Edit Index"
2. Choose "Type" tab, then click on "Assign Styles"
3. Move radio button for "Chapter Title" from 0 to 1.

Method 2:
1. Place cursor in TOC, right-click, choose "Edit Index"
2. Choose "Type" tab
3. In "Create From" section unclick "Additional Styles" and click "Outline"

=> NAB (and need to read up on how TOC works)
Comment 15 Luke Kendall 2022-04-09 13:04:30 UTC
Thanks for that, sdc, I did not know about those features (I've never tried them), but as you say they at least make all the expected entries appear in the TOC.

I can't be 100% certain I never played with those setting, but I'm 95% sure I didn't.

I also don't understand why some headings had different settings with respect to that.

The rest of the behaviour though still seems buggy:
- headings sometimes not updating (style changes not taking effect), until you exit and reopen the document
- TOC itself sometimes not updating (if you select Update Index) until closing and reopening the document,
- Some chapter headings, with the same heading style, and no direct formatting, are formatted differently
- TOC contents sometimes broken and not updating from a .docx saved version of a .odt file, even when the TOC does work in the .odt.

I uninstalled LibreOffice on my main computer and installed OpenOffice.org instead, and everything worked as expected from its UI: style changes took effect when applied, everything stayed completely consistent.  (This suggests to me that some new feature(s) in Writer can cause inconsistencies in Writer's behaviour when it comes to TOC and applying paragraph styles.)

I also today had Amazon's systems reject the .docx file created by LO, saying the file was corrupted.  After opening the source .odt with OpenOffice to fix the heading problems, by saving in its Word format, Amazon's auto checking accepted the document as no longer corrupted.

I wish you all well with LibreOffice going into the future.
Comment 16 Timur 2022-04-09 14:50:50 UTC
(In reply to Luke Kendall from comment #15)

> The rest of the behaviour though still seems buggy:
> - headings sometimes not updating (style changes not taking effect), until
> you exit and reopen the document
> - TOC itself sometimes not updating (if you select Update Index) until
> closing and reopening the document,
> - Some chapter headings, with the same heading style, and no direct
> formatting, are formatted differently
> - TOC contents sometimes broken and not updating from a .docx saved version
> of a .odt file, even when the TOC does work in the .odt.

You were an advanced user of LO and frequent bug submitter with 102 reports. 
But after so long you should have followed the rules:
- bug must have repro steps (and preferably minimal sample), the shorter the bigger chances of having someone look and fix 
- once you have repro steps, you should search first in all open and closed bugs, before reporting, 
- single issue per report (once more: with clear repro steps). 

> 
> I also today had Amazon's systems reject the .docx file created by LO,
> saying the file was corrupted.  After opening the source .odt with
> OpenOffice to fix the heading problems, by saving in its Word format,
> Amazon's auto checking accepted the document as no longer corrupted.

Sounds like a material xor a report with above checks. 


> I wish you all well with LibreOffice going into the future.

And to you.