//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Linq;usingGrapeCity.Documents.Word; namespaceDsWordWeb.Demos{// This sample shows how to list fonts embedded in a DOCX.publicclassListEmbedFonts {publicGcWordDocumentCreateDocx() {var doc = newGcWordDocument(); // Load a DOCX that contains embedded font: doc.Load(Path.Combine("Resources", "WordDocs", "EmbedFonts.docx")); var embeddedFont = doc.Fonts.FirstOrDefault(fi_ => fi_.Embedded.Count > 1)?.Embedded[0]; doc.Body.Paragraphs.Add("Embedded fonts found in this document:", doc.Styles[BuiltInStyleId.Heading1]);var myListTemplate = doc.ListTemplates.Add(BuiltInListTemplateId.BulletDefault, "myListTemplate"); // Enumerate all embedded fonts:foreach (var fi in doc.Fonts) {foreach (var ef in fi.Embedded) {var p = doc.Body.Paragraphs.Add(doc.Styles[BuiltInStyleId.ListParagraph]); p.ListFormat.Template = myListTemplate;var run = p.GetRange().Runs.Add($"Found embedded font of type {ef.Type} in font \"{fi.Name}\"."); run.Font.Name = fi.Name;if (ef.Type == EmbeddedFontType.Bold) run.Font.Bold = true;elseif (ef.Type == EmbeddedFontType.Italic) run.Font.Italic = true;elseif (ef.Type == EmbeddedFontType.BoldItalic) run.Font.Bold = run.Font.Italic = true; } } // Done:return doc; } }}