GroupDocs.Merger for Node.js via Java

Split DOCX files

GroupDocs.Merger for Node.js via Java adds powerful document manipulation features to Node.js applications. Seamlessly split DOCX files and process a variety of widely used formats.

Steps to divide DOCX files

GroupDocs.Merger allows you to split DOCX documents, extracting selected pages into a new file. Integrate efficient document management into your Node.js via Java applications.

  1. Provide the file path of the original DOCX document.
  2. Set the location where the split document will be saved.
  3. Define settings to control the split operation.
  4. Process the file and save the results.
const mergerLib = require('@groupdocs/groupdocs.merger')

// Load the original file into Merger
const merger = new mergerLib.Merger("document.docx")

// Set the destination path for the output file
const outPath = 'result.docx'

// Define split settings
const java = require('java')
const pages = java.newArray('int', [1])
const splitOptions = new mergerLib.SplitOptions(outPath, pages)

// Execute the document split
merger.split(splitOptions)
npm i @groupdocs/groupdocs.merger
click to copy
copied
More examples Documentation

Comprehensive document handling

GroupDocs.Merger for Node.js via Java provides an extensive toolkit for modifying over 50 widely used document formats with ease.

Main capabilities of GroupDocs.Merger

Merge different file types

Combine PDFs, Word documents, spreadsheets, slideshows, Visio diagrams, images, and compressed archives. Adjust merging settings to suit your needs.

Customize document structure

Modify document layout by reordering, swapping, or removing pages as needed.

Modify page orientation

Rotate pages to any angle or change between portrait and landscape formats.

Extract specific pages

Select one or multiple pages and save them as a separate document in your preferred location.

Extract even-numbered pages from DOCX document

This sample demonstrates how to split a DOCX document and save only even-numbered pages as a new file.

JavaScript

const mergerLib = require('@groupdocs/groupdocs.merger')

// Open the source document
const merger = new mergerLib.Merger("document.docx")

// Specify the output file location
const outPath = 'result.docx'

// Get the total number of pages
const info = merger.getDocumentInfo()
const lastPage = info.getPageCount()

// Configure the split operation for even pages
const rangeMode = mergerLib.RangeMode.EvenPages
const splitOptions = new mergerLib.SplitOptions(outPath, 1, lastPage, rangeMode)

// Perform the split and save the new file
merger.split(splitOptions)
npm i @groupdocs/groupdocs.merger
click to copy
copied
More examples Documentation

Overview of GroupDocs.Merger

GroupDocs.Merger for Node.js via Java is a robust document management library supporting 50+ formats, including PDF, Word, Excel, PowerPoint, Visio, images, and archives. It enables file merging, splitting, page extraction, rearrangement, swapping, and deletion, simplifying document handling within your applications.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Merger for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Core functionalities

Discover the advanced features of our document processing library.

Divide multiple file formats

GroupDocs.Merger supports over 50 document types, enabling fast and flexible modifications.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English