'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.DrawingImportsSystem.Collections.GenericImportsSystem.LinqImportsSystem.XmlImportsGrapeCity.Documents.Word '' This sample demonstrates how to add building blocks to a document's glossary.PublicClassGlossaryDocFunctionCreateDocx() AsGcWordDocumentDim doc = NewGcWordDocument() doc.Body.Paragraphs.Add("This sample demonstrates adding building blocks (custom headers and footers in this case) " +"to the document's glossary. They do not show in the generated document. To use the building blocks, " +"open the document in MS Word and explore the document's glossary.") '' Add header And footer building blocks to the document's glossary:AddHeaderBuildingBlockToGlossary(doc)AddFooterBuildingBlockToGlossary(doc) '' Now the document has two building blocks in the glossary.'' Note that when the document Is loaded into MS Word, they will Not be visible.'' To use them, open the document in MS Word And explore the document glossary.Return docEndFunction '' Add header building blockPrivateSubAddHeaderBuildingBlockToGlossary(ByRef doc AsGcWordDocument)Dim glossary = doc.GlossaryDocumentDim buildingBlocks = glossary.BuildingBlocksDim buildingBlock = buildingBlocks.Add("New cool header", "2019 collection", BuildingBlockGallery.CustomHeaders)Dim bbBody = buildingBlock.Body''here we can modify body as we wantDim p = bbBody.Paragraphs.Add("New cool building block neader") p.Style.Font.Color.RGB = Color.BlueEndSub '' Add footer building blockPrivateSubAddFooterBuildingBlockToGlossary(ByRef doc AsGcWordDocument)Dim glossary = doc.GlossaryDocumentDim buildingBlocks = glossary.BuildingBlocksDim buildingBlock = buildingBlocks.Add("New cool footer", "2019 collection", BuildingBlockGallery.CustomFooter)Dim bbBody = buildingBlock.Body'' Here we can modify the body as we want:Dim p = bbBody.Paragraphs.Add("New cool building block footer") p.Style.Font.Color.RGB = Color.PinkEndSubEndClass