Red Hat Bugzilla – Bug 476959
[fix available] Table of Contents level not correctly exported and imported to/from .doc
Last modified: 2009-09-02 05:09:08 EDT
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):
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".
Value of "Evaluate up to level" under "Create index/table" is 9.
Value of "Evaluate up to level" under "Create index/table" is 3.
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.)
Looks like something came unstuck quite a while ago around this area.
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.
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.
Created attachment 328176 [details]
Here is another file, where I see 9 in the levels field.
Both attached files are created using MS Word, but the last one has also been saved with OOo.
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"
Created attachment 328181 [details]
patch for this problem
committed to >= 2.3.0-6.11
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.