Bug 36514 - Empty style name in a Word 2 document
Summary: Empty style name in a Word 2 document
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.4.2 release
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:4.5.0 target:4.4.0.0.beta2 un...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-22 15:34 UTC by Matthew Holloway
Modified: 2023-10-18 17:09 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
The faulty document in question (278.75 KB, application/msword)
2011-04-22 15:34 UTC, Matthew Holloway
Details
Another faulty document (289.87 KB, application/msword)
2011-04-22 15:35 UTC, Matthew Holloway
Details
Showing error message on save, and unnamed style in Styles window (365.07 KB, image/png)
2014-12-01 12:37 UTC, Orest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Holloway 2011-04-22 15:34:22 UTC
Created attachment 45978 [details]
The faulty document in question

When saving what I think are old Word 2 files I get the error dialog, 

"Error saving the document NON_7.doc:
Error in writing sub-document styles.xml"

It looks like there's an empty style name, that might be causing it?

Incidentally although the text looks mangled it's actually in Thai with the charset iso8859-11 (or maybe TIS-620). When I use antiword to extract the text and then thaiconv to turn it into unicode then the Thai characters are revealed. I don't know if that's another bug because I don't know if LibreOffice should render this charset.
Comment 1 Matthew Holloway 2011-04-22 15:35:31 UTC
Created attachment 45979 [details]
Another faulty document
Comment 2 Muthu 2011-05-04 23:32:02 UTC
Reproducible.
One for cedric?
Comment 3 Matthew Holloway 2011-06-25 03:12:38 UTC
Just curious, is anyone working on this? Is there anything I can do to help?
Comment 4 Derek Chirnside 2011-08-15 14:25:48 UTC
(In reply to comment #3)
> Just curious, is anyone working on this? Is there anything I can do to help?

A WORKAROUND:
I had a lot of files created in Microsoft Office 97 I suddenly needed.  They all gave the "error in writing sub document styles.zml" when I opened them and tried to save in ODT format.  There are some old bug reports from 2008 in the OO forums.  Not word of any fixes, just some comments on "empty styles" and periods and numbers maybe as the cause.

I tried saving in docx format using LO, No go.
I then 
(1) loaded some files onto PC MS Office 2007
(2) opened them in Office (and went through a process of changing the registry to enable this!!!) here: http://support.microsoft.com/?kbid=922850 
(3) saved as docx
(4) transferred them back to the LO computer

They now open and save fine, no more "error in writing sub document styles.zml" errors.  I have found a bulk convert utility to do the other 2000 files.
Comment 5 Urmas 2012-03-11 05:59:33 UTC
That problem affects not Thai only. The Word 2 importer doesn't correct erroneous ANSI charset for fonts in localized Windows 3 versions.
Comment 6 Lila 2014-03-15 15:29:53 UTC
I have had this problem with my word 2 (italian localized)late '90s documents, but I could save them as Microsoft Word 97/2000/XP/2003 (.doc) documents. I had then to close the document and reimport it in order to get rid of the empty styles I could not delete from the style manager and I could save them as odf at last. Hope this can help
Comment 7 Julien Nabet 2014-05-28 21:36:46 UTC
On pc Debian x86-64 with master sources updated yesterday, I could reproduce this.

I noticed several times this line on console:
warn:legacy.osl:3030:1:sw/source/filter/ww8/ww8par.cxx:3599: WW8: Please report this document, it may have a missing graphic
Git history indicates this part has been added by http://cgit.freedesktop.org/libreoffice/core/commit/?id=1933979aab720c30a987636cab4070702f1f95e2

Caolan: is this warn still relevant in this old but still alive bug?
Comment 8 Orest 2014-12-01 12:35:38 UTC
See attached. Similar error but unable to complete save. There appears to be an unnamed style in the Styles list on right. Has happened twice but do not yet know how to reproduce.
Comment 9 Orest 2014-12-01 12:37:27 UTC
Created attachment 110295 [details]
Showing error message on save, and unnamed style in Styles window
Comment 10 Urmas 2014-12-02 12:41:03 UTC
There is a style with id 1 which has 0xFF in all three arrays. It is ignored by MS Word apparently, but not by LO.
Comment 11 Commit Notification 2014-12-02 17:03:27 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=52979151ca45f9a8aff1694f3c4e1b87ef971ba8

Resolves: fdo#36514 avoid empty style names in ww2 docs

It will be available in 4.5.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2014-12-02 17:07:04 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f070a64a1d3ccdb382a189506bd4c5001411fc11&h=libreoffice-4-4

Resolves: fdo#36514 avoid empty style names in ww2 docs

It will be available in 4.4.0.0.beta2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 13 Buovjaga 2023-10-18 17:09:52 UTC
Notes for unit test writers:

Revert has to be done manually.