'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.DrawingImportsSystem.LinqImportsGrapeCity.Documents.Word PublicClassCopyKeepSourceFunctionCreateDocx() AsGcWordDocumentConststyleNameAsString = "X-style" Dim doc = NewGcWordDocument() Dim xStyleTgt = doc.Styles.Add(styleName, StyleType.Paragraph) xStyleTgt.Font.Color.RGB = Color.Blue xStyleTgt.Font.Bold = True xStyleTgt.ParagraphFormat.Indentation.RightIndent += 72Dim textTgt = $"This paragraph in the target document " &$"is associated with a custom paragraph style named ""{styleName}"". " &$"That style specifies the font to be blue and bold, and the whole paragraph " &$"is indented by 1"" on the right." doc.Body.Paragraphs.Add(textTgt, doc.Styles(styleName)) Dim docSrc = NewGcWordDocument()Dim xStyleSrc = docSrc.Styles.Add(styleName, StyleType.Paragraph) xStyleSrc.Font.Color.RGB = Color.Red xStyleSrc.Font.Italic = True xStyleSrc.ParagraphFormat.Alignment = ParagraphAlignment.Right xStyleSrc.ParagraphFormat.Indentation.LeftIndent += 72Dim textSrc = "This paragraph is copied from the source to the target DOCX. " &$"In the source DOCX, this paragraph was associated with a custom style also named ""{styleName}"". " &$"That style specifies the font to be red and italic, the whole paragraph is right-aligned " &$"and indented 1"" from the left. " &$"Due to a conflict with the same-named but different style in the target document " &$"its name is changed to ""{styleName}1""."Dim paraSrc = docSrc.Body.Paragraphs.Add(textSrc, docSrc.Styles(styleName)) paraSrc.GetRange().CopyTo(doc.Body, InsertLocation.End, FormattingCopyStrategy.KeepSource) Return docEndFunctionEndClass