Free Support Forum - aspose.com

Convert Word Document with Glossary Part with too Many (4000+) Styles (C# .NET) | Avoid File Corrupted Exception

I am facing issue while loading document in aspose. The code fails with error “Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.” The internal error says “System.InvalidOperationException: There are too many styles in the document”. However, the document get opens successfully in MS Word.

I am using latest aspose.words(20.6) package. I find that the glossary part (style.xml) is having lot of styles (4000)+ and then only it fails to load in aspose.words. The MS Word adds those per edit and document contains plain text content controls. Those styles get auto added per document open in MS Word.

Interesting thing is the aspose.words (18.6) is not complaining about loading the document but fails with save operation, however, the 20.6 fails with loading the document. i.e. following

//The line is failing (20.6) but not in (18.9)
var wrdf = new Aspose.Words.Document( "./input.docx");

I saw there is option to cleanup the document, but it is not clear how I cleanup if it is not loading in aspose.

https://apireference.aspose.com/words/java/com.aspose.words/CleanupOptions

I have attached the code and sample input.docx file.
StyleIssue.zip (436.4 KB)

@GZaha,

We have logged this problem in our issue tracking system with ID WORDSNET-20722. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

@awais.hafeez
I see the status as analysis completed. Can you please let me know if you are going to fix it next possible build? Is there any workaround for time being.

@GZaha,

Yes, we have completed the analysis of WORDSNET-20722. But, there are no timelines and workarounds available at the moment. We will check if we may be able to calculate and share the ETA of this issue with you? Rest assured; we will inform you via this thread as soon as this issue will get resolved in future. We apologize for any inconvenience.

Can we get the timeline as “Analysis Completed”? Will it be released in 20.10?

@GZaha,

We are working on a solution but unfortunately cannot promise a timeline at the moment. We will keep you posted here on any further updates and let you know when this issue will get resolved in future. We apologize for your inconvenience.