Wednesday, October 21, 2009

OpenXml – Delete Page Breaks

Dependencies:

DocumentFormat.OpenXml.dll (version 2.0.3930.0)

Imports:

DocumentFormat.OpenXml.WordProcessing

DocumentFormat.OpenXml.Packaging

Code Snippet
  1. Private Sub DeletePageBreaks(ByRef myDoc As WordprocessingDocument)
  2. Dim noBreaks As List(Of Break) = myDoc.MainDocumentPart.Document.Descendants(Of Break)().ToList()
  3. For Each brk As Break In noBreaks
  4. brk.Remove()
  5. Next
  6. myDoc.MainDocumentPart.Document.Save(myDoc.MainDocumentPart.GetStream(FileMode.Create))
  7. End Sub

No comments:

Post a Comment

Calling .NET From COM Originally posted by Mikec276 on C Sharp Friends It might be hard to convince your IT manager to let you build y...