Replacing Section Breaks with Page Breaks

Hi,
I have a document that is created by merging several documents and the resulting merged file is comprized of several sections which Section Breaks separates them. However, I need my resulting document to be made of only one section and instead of the Section Breaks have Page Breaks. So, I need to open the merged document in Aspose.Word and replace all Section Breaks with Page Breaks and save it back to server again. Could you please let me know how this can be done?
Thanks.

Hi
Thanks for your request. Please try using the following code:

'Open document and create DocumentBuilder
Dim doc As Document = New Document("C:\Temp\in.doc")
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
'Start loop and replace all section breaks with page breaks
While (Not doc.FirstSection.NextSibling Is Nothing)
'Get second section 
Dim nextSect As Section = CType(doc.FirstSection.NextSibling, Section)
'Move DocumentBuilder cursor to the end of first section
builder.MoveTo(doc.FirstSection.Body.LastParagraph)
'if SectionStart of second section is NewPage, EvenPage or OddPage
'we should replace such break with page break
'If SectionStart is Continouse then just appent content of next section to first section
'If SectionStart is NewColumn then replace it with Column break 
If (nextSect.PageSetup.SectionStart.Equals(SectionStart.NewColumn)) Then
builder.InsertBreak(BreakType.ColumnBreak)
ElseIf (nextSect.PageSetup.SectionStart.Equals(SectionStart.Continuous)) Then
'Do nothing
Else
builder.InsertBreak(BreakType.PageBreak)
End If
'Append content of second section to first section
doc.FirstSection.AppendContent(nextSect)
'Remove next section
nextSect.Remove()
End While
'Save document
doc.Save("C:\Temp\out.doc")

Hope this helps.
Best regards.

Thank you very much Alexey, your solution worked great. Thanks.