Imports Docs.Word



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

		'	Change section break type for both sections
		Doc.Sections(0).Style.SectionBreak = SectionBreakStyle.NewPage
		Doc.Sections(1).Style.SectionBreak = SectionBreakStyle.NewPage

		'	Change text of first paragraph of second section
		Dim Par As Paragraph = DirectCast(Doc.Sections(1).Nodes(0), Paragraph)
		Par.Textruns.Clear()
		Par.AddTextrun("Here begins a new section. As you can see," _
			  & "the section break above has ""New Page"" type," _
			  & " so this new section starts on the next page.")
		Par.Textruns.Style.TextColor = Color.Red

		Return Doc
	End Function
End Class
