removeSection

removeSection

ADVANCED / PREMIUM TRIAL

Removes a section and its contents.

Description
public removeSection (string $source, string $target, int $section, [array $options])

This method allows you to remove a section and its contents in a Word document.

Parameters

source

Path to the Word document.

target

Path to the resulting document.

section

Section number to be removed: 1, 2...

options

The possible keys and values are (required options are shown with yellow background):

Key Type Description
keepSections bool Preserve or not the original sections of the splitted document. If false uses the first section for all documents. Default as true.
Exceptions

Error while trying to open the (base) template as a zip file.

There's a single section in the DOCX.

Code samples

Example #1