using System; using System.Drawing; using Docs.Word; namespace SampleManager { class Textruns_Style { internal static Document Main1() { // Open the document with given name and gets the first paragraph Document Doc = Document.ReadDOC(Form1.SourceFolder + "Textruns - Style.doc"); Paragraph Par1 = (Paragraph)Doc.Sections[0].Nodes[0]; // Change the style properties of different ranges of text Par1.GetRange(0, 38).Style.FontSize = 32; Par1.GetRange(39, 81).Style.Borders = new Border(1); Par1.GetRange(82, 142).Style.Shading = new Shading(Color.OrangeRed); Par1.GetRange(143, 185).Style.TextColor = Color.Blue; Par1.GetRange(194, 204).Style.VerticalPosition = 5; Par1.GetRange(217, 245).Style.HorizintalScale = 200; Par1.GetRange(246, 305).Style.FontStyle.Bold = true; Par1.GetRange(306, 348).Style.FontStyle.AllCaps = true; Par1.GetRange(349, 410).Style.FontStyle.DoubleStrike = true; Par1.GetRange(411, 473).Style.FontStyle.Emboss = true; Par1.GetRange(490, 541).Style.FontStyle.Imprint = true; Par1.GetRange(542, 628).Style.FontStyle.Italic = true; Par1.GetRange(629, 681).Style.FontStyle.Outlined = true; Par1.GetRange(682, 707).Style.FontStyle.Shadow = true; Par1.GetRange(708, 759).Style.FontStyle.SmallCaps = true; Par1.GetRange(760, 794).Style.FontStyle.StrikeThrough = true; Par1.GetRange(795, 815).Style.FontStyle.SubScript = true; Par1.GetRange(815, 833).Style.FontStyle.SuperScript = true; Par1.GetRange(834, 873).Style.FontStyle.TextEffect = TextEffect.BlackAnts; Par1.GetRange(874, 906).Style.FontStyle.TextEffect = TextEffect.LasVegasLights; Par1.GetRange(907, 957).Style.FontStyle.Underlined = true; Paragraph Par2 = (Paragraph)Doc.Sections[0].Nodes[1]; Par2.GetRange(0, 50).Style.FontStyle.Bold = true; Par2.GetRange(50, 96).Style.FontStyle.Italic = true; Par2.GetRange(27, 70).Style.TextColor = Color.Blue; return Doc; } } }