Geeks With Blogs
Athens's Id Permanent Resident of the Blue Nowhere

using System;

using System.Collections.Generic;

using System.IO;

using System.Linq;

using System.Linq.Expressions;

using System.Xml;

using System.Xml.Linq;

using DocumentFormat.OpenXml;

using DocumentFormat.OpenXml.Packaging;

using System.Text;

using System.IO.Packaging;

using DocumentFormat.OpenXml.Wordprocessing;



/// <summary>

/// DocumentExtensions contains functions to manage the creation, reading and writing of XDocument objects

/// that come from an OpenXmlPackage

/// </summary>

public static class DocumentExtensions


public static void RemovePageBreaks(this Document document)


List<Break> breaks = document.Descendants<Break>().ToList();

foreach (Break b in breaks)






public static void RemoveSectionBreaks(this Document document)


List<ParagraphProperties> paraProps = document.Descendants<ParagraphProperties>()

.Where(pPr => ParagraphPropertiesExtensions.IsSectionProps(pPr)).ToList();

foreach (ParagraphProperties pPr in paraProps)






Posted on Wednesday, July 1, 2009 5:36 PM OpenXML | Back to top

Related Posts on Geeks With Blogs Matching Categories

Comments on this post: Extensions to the OpenXml SDK - Document

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Athenz | Powered by: