Imports Docs.Word


Public Class Open_Edit_Save
	Friend Shared Function Main1() As Document
		'	Open the document with given name
		Dim Doc As Document = Document.ReadDoc(Form1.SourceFolder + "OpenEditSave.doc")

		'	Get the first paragraph of document
		'	Adds the new textrun at the end of this paragraph
		Dim Par1 As Paragraph = DirectCast(Doc.Sections(0).Nodes(0), Paragraph)
		Par1.AddTextrun(" Hello! Hello!")

		'	Get the second paragraph and changes style properties of its textruns
		Dim Par2 As Paragraph = DirectCast(Doc.Sections(0).Nodes(1), Paragraph)
		Par2.Textruns.Style.FontStyle.Italic = True
		Par2.Textruns.Style.FontStyle.Bold = False
		Par2.Textruns.Style.TextColor = Color.Blue

		Return Doc
	End Function
End Class
