# Glossary Document

DsWord is capable of maintaining a glossary document for a Word document to store the building blocks content. Learn how to create building blocks in DsWord docs.

## Content

A glossary document is a supplementary storage which stores the content, such as AutoText/Buildingblock entries that you do not want to appear in the document, but want to keep it as the part of document for future insertion, if needed. DsWord provides the capability of maintaining a GlossaryDocument for a Word document to store the BuildingBlocks content. It is represented using the [GlossaryDocument](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.GlossaryDocument.html) class.
GlossaryDocument class maintains the collection of building blocks using the [BuildingBlockCollection](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.BuildingBlockCollection.html) class. The BuildingBlockCollection class provides [Add](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.BuildingBlockCollection.Add.html) and [Remove](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.BuildingBlockCollection.Remove.html) method to add and remove the blocks from the glossary document respectively.
Building blocks is an essential feature of word which allows you to insert blocks of information in the document. These blocks of information can be reusable chunks of content or pre-designed and pre-formatted blocks of text and formatting. DsWord allows you to create, modify and delete building blocks using the BuildingBlock class.

## Create Building Block in Glossary Document

To create and add building blocks in a glossary document:

1. Create an instance of the GcWordDocument class to create a document. The **GlossaryDocument** property of this class returns the Glossary Document specific to the Word document.
2. Add the building block to the Glossary document using the **Add** method of BuildingBlockCollection.

    ```csharp
    GcWordDocument doc = new GcWordDocument();
    
    //Adds a building block that contains text
    BuildingBlock bb1 = doc.GlossaryDocument.BuildingBlocks.Add("Mission_Statement", "CompanyInfo", BuildingBlockGallery.AutoText, BuildingBlockInsertOptions.Content, BuildingBlockType.None);
    Style paraStyle = bb1.Body.Document.Styles.Add("paraStyle", StyleType.Paragraph);
    paraStyle.Font.Bold = true;          
    bb1.Body.Paragraphs.Add("To serve our customers by helping them to achieve their goals", paraStyle);
    
    //Save the document (Note:Building blocks can be saved in dotx and docx, but in the docx format, MS Word UI won't show them)
    doc.Save("CustomBuildingBlocks.dotx", DocumentType.Template);
    ```

## Remove Building Block from Glossary Document

To remove building block from glossary document:

1. Load the document using **Load** method of GcWordDocument class.
2. Invoke **Remove** method of the **BuildingBlockCollection** class to remove the building block from glossary document.

    ```csharp
    GcWordDocument doc = new GcWordDocument();
    doc.Load("CustomBuildingBlocks.dotx");
    doc.GlossaryDocument.BuildingBlocks.Remove(doc.GlossaryDocument.BuildingBlocks.First);
    ```