How do I remove the section break?

Hi,
I want to remove the section break,but it does not work.My codeis:

zk.zip (12.7 KB)

Document doc = new Document(“zk.docx”);
doc.getRange().replace(ControlChar.SECTION_BREAK, “&p”,new FindReplaceOptions());

Thanks very much

@zhengkai

Thanks for your inquiry. Please use the following code example to remove section break. Hope this helps you.

Document doc = new Document(MyDir + "input.docx");
 for (int i = doc.Sections.Count - 2; i >= 0; i--)
  {
     doc.LastSection.PrependContent(doc.Sections[i]);
     doc.Sections[i].Remove();
  }
doc.Save(MyDir + "18.11.docx");

Moreover, please read the following article.
How to Remove Section Breaks

Thanks for your help!