Splitter
Use the Wordize Splitting for .NET module to split your documents into parts. You can also select any document conversion module to work with the required formats.
A full list of conversion modules can be found on the Supported Document Formats page.
Wordize provides the Wordize Splitting for .NET module, which allows users to split large documents into multiple smaller documents programmatically. This feature is useful for dividing large content into manageable sections on a page-by-page basis, as well as based on sections, page ranges, and paragraph styles.
Additionally, Wordise allows you to remove blank pages from your documents to improve readability and ensure a professional appearance, as well as reduce file size and prevent printing unnecessary pages.
Let’s look at each of these methods in more detail.
Split Page by Page
Wordize allows users to split a document page by page. So if you have a document of 5 pages, using this method of splitting the document you will get 5 documents of 1 page each.
Use one of the Split methods to do this:
- Split(string, string, SplitOptions)
- Split(Stream, SaveFormat, SplitOptions)
- Split(string, string, SaveFormat, SplitOptions)
The following code example shows how to split a document into pages using the Split(string, string, SplitOptions) method:
string doc = MyDir + "BigDocument.docx";
SplitOptions options = new SplitOptions();
options.SplitCriteria = SplitCriteria.Page;
Splitter.Split(doc, ArtifactsDir + "SplitDocument.1.docx", options);
Split by Sections
Wordize also allows to use section breaks to split documents into sections. For this purpose, use the SectionBreak value of the SplitCriteria property. Also use one of the Split methods to do this:
- Split(string, string, SplitOptions)
- Split(Stream, SaveFormat, SplitOptions)
- Split(string, string, SaveFormat, SplitOptions)
The following code example shows how to split a document into sections using the Split(Stream, SaveFormat, SplitOptions) method:
using (FileStream streamIn = new FileStream(MyDir + "BigDocument.docx", FileMode.Open, FileAccess.Read))
{
SplitOptions options = new SplitOptions();
options.SplitCriteria = SplitCriteria.SectionBreak;
Stream[] stream = Splitter.Split(streamIn, SaveFormat.Docx, options);
}
Split by Styles
Wordize allows you to split a document into parts by paragraph, formatted using the style specified in SplitOptions.SplitStyle. Use one of the Split methods to do this:
- Split(string, string, SplitOptions)
- Split(Stream, SaveFormat, SplitOptions)
- Split(string, string, SaveFormat, SplitOptions)
The following code example shows how to split a document into sections using the Split(string, string, SaveFormat, SplitOptions) method:
string doc = MyDir + "BigDocument.docx";
SplitOptions options = new SplitOptions();
options.SplitCriteria = SplitCriteria.Style;
options.SplitStyle = "Heading 1";
Splitter.Split(doc, ArtifactsDir + "SplitDocument.1.docx", SaveFormat.Docx, options);
Split by Page Ranges
Wordize allows you to extract a specific page ranges from a multi-page document. Just select a range of pages and keep only that part of the original document.
Use one of the ExtractPages methods to do this:
- ExtractPages(string, string, int, int)
- ExtractPages(Stream, Stream, SaveFormat, int, int)
- ExtractPages(string, string, SaveFormat, int, int)
The following code example shows how to extract a page range from a document using the ExtractPages(string, string, int, int) method:
string doc = MyDir + "BigDocument.docx";
Splitter.ExtractPages(doc, ArtifactsDir + "LowCode.ExtractPages.1.docx", 0, 2);
Remove Blank Pages
You can also remove blank pages from the document. Use one of the RemoveBlankPages methods to do this:
- RemoveBlankPages(string, string)
- RemoveBlankPages(Stream, Stream, SaveFormat)
- RemoveBlankPages(string, string, SaveFormat)
The following code example shows how to extract a page range from a document using the RemoveBlankPages(string, string) method:
string doc = MyDir + "BlankPages.docx";
Splitter.RemoveBlankPages(doc, ArtifactsDir + "RemoveBlankPages.1.docx");