Imports Docs.Word



Public Class Textruns_Style
	Friend Shared Function Main1() As Document
		'	Open the document with given name and gets the first paragraph
		Dim Doc As Document = Document.ReadDoc(Form1.SourceFolder + "Textruns - Style.doc")
		Dim Par1 As Paragraph = DirectCast(Doc.Sections(0).Nodes(0), Paragraph)

		'	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

		Dim Par2 As Paragraph = DirectCast(Doc.Sections(0).Nodes(1), Paragraph)
		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
	End Function
End Class
