'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.Collections.GenericImportsSystem.LinqImportsGrapeCity.Documents.Word PublicClassLinkedStyleFunctionCreateDocx() AsGcWordDocumentDim logList = NewList(OfString)()Dim Log As Action(OfString) = Sub(message AsString) logList.Add(message) Dim doc = NewGcWordDocument() doc.HideLinkedCharacterStyles = False Dim linkedStyle = doc.Styles.AddLinkedStyle("Linked Style", doc.Styles(BuiltInStyleId.Heading1)) Log($"Linked paragraph style is linked: {linkedStyle.Linked}") Log($"Linked paragraph style name: {linkedStyle.Name}") Log($"Linked paragraph style type: {linkedStyle.Type}") Log($"Linked character style is linked: {linkedStyle.LinkStyle.Linked}") Log($"Linked character style name: {linkedStyle.LinkStyle.Name}") Log($"Linked character style type: {linkedStyle.LinkStyle.Type}") linkedStyle.Font.Bold = True Log($"Linked paragraph style is bold: {linkedStyle.Font.Bold}") Log($"Linked character style is bold: {linkedStyle.LinkStyle.Font.Bold}") doc.Body.Paragraphs.Add("This paragraph is formatted with a linked style that is applied to the whole paragraph as a paragraph style.", linkedStyle) Dim paragraph = doc.Body.Paragraphs.Add("In this paragraph, ", doc.Styles(BuiltInStyleId.Normal))Dim run = paragraph.GetRange().Runs.Add("this run is formatted with the same linked style applied to the run as a character style.", linkedStyle) Log($"HideLinkedCharacterStyles is: {doc.HideLinkedCharacterStyles}") Log($"Styles collection has character linked styles: {doc.Styles.FirstOrDefault(Function(x) x.LinkedAndAlso x.Type = StyleType.Character) IsNotNothing}") Log($"Run style name: {run.Style.Name}") doc.HideLinkedCharacterStyles = True Log($"HideLinkedCharacterStyles is: {doc.HideLinkedCharacterStyles}") Log($"Styles collection has character linked styles: {doc.Styles.FirstOrDefault(Function(x) x.LinkedAndAlso x.Type = StyleType.Character) IsNotNothing}") Log($"Run style name: {run.Style.Name}") doc.Body.Paragraphs.Add("Log (see example code for details):", doc.Styles(BuiltInStyleId.Heading2)) logList.ForEach(Sub(m_) doc.Body.Paragraphs.Add(m_, doc.Styles(BuiltInStyleId.NoSpacing))) Return docEndFunctionEndClass