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.
I have attached the code and sample input.docx file.
StyleIssue.zip (436.4 KB)