@qingyuan.ni,
Thanks for your inquiry. GlossaryDocument class represents the root element for a glossary document within a Word document. A glossary document is a storage for AutoText, AutoCorrect entries and Building Blocks.
To access building blocks, you need to load a document into a Document object. Building blocks will be available via the GlossaryDocument property. GlossaryDocument can contain any number of BuildingBlock objects. Each BuildingBlock represents one document part.
Please check the following code example. Hope this helps you. If you still face problem, please share your expected output document here for our reference. We will then provide you more information on this.
Document doc = new Document(MyDir + "template0.docx");
NodeImporter importer = new NodeImporter(doc.GlossaryDocument.Document, doc, ImportFormatMode.KeepSourceFormatting);
foreach (BuildingBlock buildingBlock in doc.GlossaryDocument.BuildingBlocks)
{
if (buildingBlock.Type == BuildingBlockType.StructuredDocumentTagPlaceholderText)
{
Node node = importer.ImportNode(buildingBlock.FirstSection, true);
doc.Sections.Add(node);
}
}
doc.Save(MyDir + "output.docx");