Bug 476959 - [fix available] Table of Contents level not correctly exported and imported to/from .doc
[fix available] Table of Contents level not correctly exported and imported t...
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: openoffice.org (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Caolan McNamara
Depends On:
  Show dependency treegraph
Reported: 2008-12-18 05:10 EST by Toralf
Modified: 2009-09-02 05:09 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-09-02 05:09:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Example doc file (23.50 KB, application/msword)
2009-01-05 02:16 EST, Toralf
no flags Details
Another example (34.00 KB, application/msword)
2009-01-05 02:18 EST, Toralf
no flags Details
patch for this problem (11.03 KB, patch)
2009-01-05 05:55 EST, Caolan McNamara
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
OpenOffice.org 97488 None None None Never

  None (edit)
Description Toralf 2008-12-18 05:10:29 EST
Description of problem:
A table of contents read from a .doc file will always have the value for "Evaluate up to level" set to 9, regardless of what is stored in the file 

Version-Release number of selected component (if applicable):

How reproducible:
Every time

Steps to Reproduce:
1. Create a new text document.
2. Select "Heading 1" from the paragraph style menu, then enter a short line of text.
3. Select Insert->Indexes and Tables...->Indexes and Tables...
4. Under "Create index/table", change the value for "Evaluate up to level" from 10 (the default) to 3. Then select OK (you now get an empty table of contents.)
5. Select File->Save, display the File Type list, select "Microsoft Word 97/2000/XP."
6. Enter a file name, then press Save.
7. Exit openoffice.org
8. Restart, then open the file you just saved.
9. Right-click on the table of context field, then select "Edit index/table".
Actual results:
Value of "Evaluate up to level" under "Create index/table" is 9.

Expected results:
Value of "Evaluate up to level" under "Create index/table" is 3.

Additional info:
This also happens when creating a file with MS Word, setting a similar option for index level.

When opening the above mentioned file in MS Word, the level setting is actually correct (i.e. the value is 3.)
Comment 1 Caolan McNamara 2008-12-18 13:19:41 EST
Looks like something came unstuck quite a while ago around this area.
Comment 2 Caolan McNamara 2008-12-22 07:00:19 EST
Ok, got a patch for the problems I see here on .doc export and .doc import. Just to be sure though I've tackled all the reported problems you mention "this also happens when creating a file with MS Word, setting a similar option for index level", can you attach such a sample document to avoid disappointment.
Comment 3 Toralf 2009-01-05 02:16:42 EST
Created attachment 328175 [details]
Example doc file

OK. Here is a file at last.

But actually, I'm a bit confused now, as I see the value 10 in OOo in this case, where I get 9 with some other files. The expected setting is 3, however.
Comment 4 Toralf 2009-01-05 02:18:25 EST
Created attachment 328176 [details]
Another example

Here is another file, where I see 9 in the levels field.
Comment 5 Toralf 2009-01-05 02:19:26 EST
Both attached files are created using MS Word, but the last one has also been saved with OOo.
Comment 6 Caolan McNamara 2009-01-05 05:55:32 EST
in #4 "TOCTST.DOC" the msword field code is TOC \o "1-9" \t "Heading 9,9,Heading 8,8,Heading 7,7,Heading 6,6,Heading 5,5,Heading 4,4,Heading 3,3,Heading 2,2,Heading 1,1" \h

i.e. make a toc from the outline levels 1 to 9 and from styles Heading 1 to Heading 9 assigning Heading 1 to 1, Heading 2 to 2 etc. The use of both \o and \t is a bit redundant and was likely exported from writer, the above patch would cleans up that sort of thing on initial export.

Anyway, given the .doc as it is, on loading this into word or writer then 1 to 9 is the correct setting, so that works fine in word and writer.

In #3 "TOCTST3.DOC" the code is TOC \o i.e. "make it from all outline styles" writer has 10 such styles, and word has 9 which is why there is the difference. Because word has only 9 styles we should always import that bare "use all outline styles" as evaluate up to level 9 rather than leaving it at our writer default of 10. So I've updated the patch to handle that clip to 9 levels on import rather than 10.

In either case though the msword field refers to *9* outline levels, not three. Though the msword UI itself might give the impression in the toc dialog that there are three levels, there really are nine. 

So I'm confident that the major problem is in the export, with only a little problem in the import and that the new patch "does the right thing"
Comment 7 Caolan McNamara 2009-01-05 05:55:59 EST
Created attachment 328181 [details]
patch for this problem
Comment 8 Caolan McNamara 2009-03-12 07:15:14 EDT
committed to >= 2.3.0-6.11
Comment 12 errata-xmlrpc 2009-09-02 05:09:08 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.