Created attachment 163437 [details]
Example file from Word with TOC paragraph styles
Attached user made document has a TOC and there are custom styles (TJ 1-9) defined for it.
On the first level TOC entries is “TJ 1” style applied, on the second level it’s “TJ 2”. These have 0 before/after/hanging indent set.
When opened in Writer the before/after/first line indents get crazy values, making the first level TOC text unreadable.
More observations: “TJ 1” style is based on “Tartalom fejezetcím” style. Which is based on “Címsor 2” style, that has 19.32 cm hanging indent – this shows up in Writer; also 1 cm left indent which does not.
“Címsor 2” is based on “Címsor 1” which has 0 left and right indent, 0.75 cm hanging. “Címsor 1” is based on “Normal” which has 0 left and right indent and no hanging indent.
I don’t see where the 15.5 cm before and -4,82 after indents are inherited in Writer, but the 19,32 first line indent is from the “Címsor 2” style. See also bug #132752
Also the “TJ 1-9” styles do not show up in the Styles sidebar at all.
Steps to reproduce:
1. Open attached document
First level TOC entries unreadable due to spacing settings.
Version: 220.127.116.11.alpha0+ (x64)
Build ID: b1c83b68bfbf3477fa6a8f4c79c53f6f9ab31f8e
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Verzió: 18.104.22.168 (x86)
Build az.: b0a288ab3d2d4774cb44b62f04d5d28733ac6df8
CPU szálak: 4; OS: Windows 6.3 Build 9600; Felületmegjelenítés: GL; VCL: win;
Területi beállítások: en-US (hu_HU); Felület nyelve: hu-HU
Does not happen yet (styles seem not to be applied to TOC) in:
Verzió: 22.214.171.124 (x86)
Build az.: 057fc023c990d676a43019934386b85b21a9ee99
CPU szálak: 4; OS: Windows 6.3; Felületmegjelenítés: GL; VCL: win;
Területi beállítások: hu-HU (hu_HU); Felület nyelve: hu-HU
Bibisected using bibisect-win64-6.4 to:
author Justin Luth <firstname.lastname@example.org> 2019-08-01 15:50:00 +0300
committer Justin Luth <email@example.com> 2019-08-01 19:28:54 +0200
tdf#126544 writerfilter: check parent style exists before assigning
Adding CC to: Justin Luth
It might be possible that this has just uncovered something pre-existing.
Created attachment 163438 [details]
Screenshot of the original document side by side in Word and Writer
Build ID: d8270636a57e7dc68ede51308c380e2098f765d7
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
I think that the problem is that w:styleId="Tartalomfejezetcm" tries to set indent before text to be larger than the page width (LO UI limits it to 15.5cm)
and so I'm guessing that LO spills the excess amount into a negative indent after text. (15.5+4.83 = 20.33)
<w:ind w:left="11520" w:hanging="10953"/>
MS Word 2003 reports that Tartalomfejezetcm has a left indent of 1cm, and a hanging of 19.32 (=20.32). If I apply the Tartalomfejezetcm style to the line instead of TOC 1 (TJ1), then Word goes really bizarre. (Word 2016 does the same thing - the text is tried to be placed one character per line at position 20.32 I guess - which is offscreen.)
For some reason, Word explicitly states TOC 1 has indent of 0, first of 0. Is it doing something special to prevent inheritance for the TOC styles? W:ind certainly is not defined by the style itself. And yet with the UI I can re-inherit from Tartalomfejezetcm and then Word goes berserk as well.
So it seems there are some illegal things in this document (Word's UI does not allow such a large left indent for example.)
(In reply to Justin L from comment #3)
> So it seems there are some illegal things in this document (Word's UI does
> not allow such a large left indent for example.)
It seems to depend on the paragraph location too:
- For Normal paragraph in document body on an A4 page it is 14,7 cm (Hanging+Left+Right)
- In the TOC in this example document it is 26,6 cm. Although the TOC starts to look quite funny after that.
(In reply to NISZ LibreOffice Team from comment #4)
> (In reply to Justin L from comment #3)
> > So it seems there are some illegal things in this document (Word's UI does
> > not allow such a large left indent for example.)
> It seems to depend on the paragraph location too:
> - For Normal paragraph in document body on an A4 page it is 14,7 cm
> - In the TOC in this example document it is 26,6 cm. Although the TOC starts
> to look quite funny after that.
- For direct formatting the limit is 14,7 cm
- For paragraph style the limit is 26,6 cm
For an A4 page.
For A3 the paragraph style limit is the same, but direct formatting goes up to 23,4 cm.