//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Linq;usingGrapeCity.Documents.Word; namespaceDsWordWeb.Demos{// This sample shows how to remove all hard page breaks// (including page breaks associated with sections)// from a DOCX. // See also the RemoveEmptyPages sample.publicclassRemovePageBreaks {publicGcWordDocumentCreateDocx() {var doc = newGcWordDocument(); doc.Load(Path.Combine("Resources", "WordDocs", "breaks.docx"));// Remove all hard page breaks:foreach (var brr in doc.Body.Texts.Where(txt => txt isBreak br && br.Type == BreakType.Page).ToArray()) brr.Delete();// Change all section starts to continuous:for (var sec = doc.Body.Sections.First; sec.Next != null; sec = sec.Next)if (sec.PageSetup.SectionStart != SectionStart.Continuous) sec.PageSetup.SectionStart = SectionStart.Continuous;return doc; } }}