Bug 67036

Summary: FILEOPEN Content of Table of Content not imported (.doc)
Product: LibreOffice Reporter: Oliver Specht <o.specht>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: cno, pje335-lo, stephane.guillou, stx123, thomas.lendo, timur, xiscofauli
Priority: medium Keywords: bibisected, bisected, filter:doc, regression
Version: 4.0.4.2 release   
Hardware: Other   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=31379
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 112862    
Attachments: sample document containing a TOC
ooxml version of the document
Sample DOC Compare MSO OO LO4.4 LO5.4+

Description Oliver Specht 2013-07-18 11:38:39 UTC
Created attachment 82585 [details]
sample document containing a TOC

Load bugdoc.
On Page 1 there's only the heading of the table of contents but no entries.

The same file in .docx is loaded correctly.
Comment 1 Cor Nouws 2013-07-19 08:09:55 UTC
Hi Olivier ;)

Thanks for the report.
Indeed I see no TOC. And that is the same in LibreOffice 3.3.0.
Do you have a version of the docx file to?

And do you mean with the report, that initialy the docx was opend, then saved as .doc and that then the TOC was missing?

Regards,
Cor
Comment 2 Oliver Specht 2013-07-19 08:38:37 UTC
Created attachment 82663 [details]
ooxml version of the document
Comment 3 Oliver Specht 2013-07-19 08:41:13 UTC
AFAIK the doc has been created by Word (2010 or 2013).
Comment 4 Oliver Specht 2013-08-08 09:07:27 UTC
The TOC is not imported since the following commit:

commit d36940de4f88bc4f190dcddb79568ef0d08b8427
Author: Cédric Bosdonnat <cedricbosdo@openoffice.org>
Date:   Tue Oct 12 10:15:39 2010 +0200

    WW8: Fixed the import of nested SET / FILLIN fields
    
    n#634478

This could be fixed with the following diff:

diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 1f4d9e8..63fe016 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1007,9 +1007,11 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
     bool bOk = pF->GetPara(pRes->nCp2OrIdx, aF);
 
     OSL_ENSURE(bOk, "WW8: Bad Field!\n");
     if (aF.nId == 33) aF.bCodeNest=false; // do not recurse into nested page fields
     bool bCodeNest = aF.bCodeNest;
-    if ( aF.nId == 6 ) bCodeNest = false; // We can handle them and loose the inner data
+    if ( aF.nId == 6 || aF.nId == 13) 
+        bCodeNest = false; // We can handle them and loose the inner data
 
     maFieldStack.push_back(WW8FieldEntry(*pPaM->GetPoint(), aF.nId));

->Cédric: Could you please have a look?
Comment 5 Thomas van der Meulen [retired] 2013-09-29 07:40:02 UTC
Thank you for your bug report,
I can reproduce this bug running LibreOffice: 
Version: 4.2.0.0.alpha0+
Build ID: 164b6ce7b27c0a9ec19019e7b078b9f8f382007d
TinderBox: Win-x86@39, Branch:master, Time: 2013-09-28_16:39:4
And Mircosoft Office 2007

Is this a regression then? If it is please add regresion to the keywords.
Comment 6 Cédric Bosdonnat 2014-01-20 08:57:41 UTC
Restricted my LibreOffice hacking area
Comment 7 Stéphane Guillou (stragu) 2014-03-05 06:53:23 UTC
I can reproduce this with 4.1.5.1 (Build ID: e0a1805d063a472a7b281ae3977a26d42a48b20) using the two attachments provided.

Could anyone test the diff provided in Comment 4?
Comment 8 Joel Madero 2015-05-02 15:43:27 UTC Comment hidden (obsolete)
Comment 9 Oliver Specht 2015-05-04 07:23:07 UTC
Test Version: 4.4.2.2 on Windows 10 Pro Technical Preview
The bug occurs differently now:
The text of the TOC is visible now but it is no TOC but simple text.
Comment 10 QA Administrators 2016-09-20 09:37:15 UTC Comment hidden (obsolete)
Comment 11 Stéphane Guillou (stragu) 2016-09-20 12:29:02 UTC
With:
LO 5.1.5.2 (Build ID: 1:5.1.5~rc2-0ubuntu1~trusty1) on KXStudio 14.04

Both sample documents now show the headings in the table of content.

The behaviour is inconsistent though: the .doc has page numbers that are clickable with ctrl+click, whereas it is not possible to use that shortcut with the .docx.

The issue(s) seem(s) different to the original bug report, should we close this one and open a new one?
Comment 12 Timur 2017-01-31 10:17:15 UTC
Created attachment 130788 [details]
Sample DOC Compare MSO OO LO4.4 LO5.4+

This bug started as "Table of Content not imported (.doc)" and as noted, it was changed at least from LO 4.4. Same is now with 5.4+ master. 

So I'd say yes to Comment 11: close this one and possibly open a new for specific issues, if not already reported and worth reporting:
- TOC in DOC has Contents style but it's simple text and not proper TOC
- First heading in TOC is not properly imported - instead of "1. jupp" just "upp" is imported, "1. j"  missing, which may be related to not proper TOC
- DOCX page numbers not clickable with ctrl+click - until right-click "Update index" when they become clickable

Proper bug report would not only report DOC and DOCX separately, but test to see if this is related to this specific document only.
Comment 13 Thomas Lendo 2017-04-26 22:41:01 UTC
stragu and Timur, inconsistent or buggy behavior should be handled in new, separate bug reports. If the ToC is imported, this bug should be closed as WORKSFORME. But if there is a main bug which makes the import incomplete, this bug can be renamed to reflect the current problem.

For the several bugs both of you found, please search for already reported ones in Bugzilla and comment there or make new bugs with a actual test file.
Comment 14 Xisco Faulí 2017-10-03 14:00:15 UTC
(In reply to Thomas Lendo from comment #13)
> stragu and Timur, inconsistent or buggy behavior should be handled in new,
> separate bug reports. If the ToC is imported, this bug should be closed as
> WORKSFORME. But if there is a main bug which makes the import incomplete,
> this bug can be renamed to reflect the current problem.
> 
> For the several bugs both of you found, please search for already reported
> ones in Bugzilla and comment there or make new bugs with a actual test file.

I agree, the ToC is imported in

Version: 6.0.0.0.alpha0+
Build ID: 34e8fd7e99489e9f50a512b07c6f3923b358b4d3
CPU threads: 4; OS: Linux 4.10; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

Closing as RESOLVED WORKSFORME