Free Support Forum -

Glossary Document


I want to understand what GlossaryDocument means.

What happens when we change a document’s GlossaryDocument using Aspose API Document.setGlossaryDocument().

Example: A document has a glossary document that has styles as well defined under glossary (/word/glossary/styles.xml). We set this document’s glossary document like below:

 Document doc=new Document("wordDoc.docx");
doc.setGlossaryDocument(new GlossaryDocument());  **//What would be the impact of this call on the document? Will it change the content of the document?**"saveWordDoc.docx");

Looking forward to your reply.



It is the root element for a glossary document within a Word document. The glossary document stores AutoText, AutoCorrect entries and Building Blocks. Some documents, usually templates, can contain AutoText, AutoCorrect entries and/or Building Blocks (also known as glossary document entries, document parts or building blocks). See the attached image of building blocks. BuildingBlockOrganizer.png (31.9 KB)

Yes, your understanding is correct. This code initializes a new instance of the GlossaryDocument that contains no content.


Thank you for answering all the queries.

Does setting the GlossaryDocument to a new GlossaryDocument cause any change in the visual content of the Word document means the content that we see when we open the word document using MS Word?

Can setting the GlossaryDocument make the word document an invalid document?

We have a case where we have multiple word document whose glossary document has large number of styles (like 3000 plus) and we get illegalStateException (“Too many styles in the document”) when we append them using Aspose Document.append() method. We do clean the documents (using Document.cleanup()) as well but that also does not help.

Yes, setting the GlossaryDocument to a new GlossaryDocument resolves the issue (mean append does not throw any exception) as it removes all styles defined under glossary but we don’t know how this step would impact the document in terms of its visual content and behavior. Will the document lose any important information after this step? What is the importance of styles defined under glossary? How much is it important for a document to retain its glossary document?



No, it will not change in the visual content of Word document.

No, it will not make the document invalid.

Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing. Please also ZIP and attach your documents.

We will investigate the issue on our side and provide you more information.

Please share the complete detail of your use case along with documents and code to test this case. We will investigate this issue and provide you more information on it