addSection
- addBibliography
- addBookmark
- addBreak
- addChart
- addCitation
- addComment
- addCrossReference
- addDateAndHour
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addOLE
- addOnlineVideo
- addPageNumber
- addShape
- addSimpleField
- addSource
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordFragment
- addWordML
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addMacroFromDoc
- addPageBorders
- addProperties
- addSection
- createDocx
- createDocxAndDownload
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- importChartStyle
- importHeadersAndFooters
- importListStyle
- importStyles
- importStylesWordDefault
- modifyPageLayout
- parseStyles
- removeFooters
- removeHeaders
- setBackgroundColor
- setDecimalSymbol
- setDefaultFont
- setDocumentDefaultStyles
- setEncodeUTF8
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHtml
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
addSection
TRIAL / ADVANCED / PREMIUM
Inserts a new section into the Word document.
Description
public addSection ( string $sectionType [, string $paperType [, array $options ] ] ] )
This method allows the creation of new sections in your Word document.
This option is needed if you wish to change the page properties, for example, from portrait to landscape orientation in part of your Word document.
All content inserted after a call to this method will be incorporated into the new section.
Parameters
sectionType
These parameters determine the kind of break (if any) used. The possible values are:
- nextPage (default value): the new section starts in a new page
- nextColumn: the new section starts in the following column
- continuous: there is no break between sections
- evenPage: the new section starts in the next available even page
- oddPage: the new section starts in the next available odd page
paperType
The type of paper to be used. The possible values are:
- A4
- A3
- letter
- legal
- A4-landscape
- letter-landscape
- legal-landscape
- custom
options
This parameter is only required if the paperType parameter has been set up to custom.
Key | Type | Description |
---|---|---|
height | int | Section height in twips. |
width | int | Section width in twips (twentieths of a point). |
marginTop | int | Top margin for this section in twips. |
marginRight | int | Right margin for this section in twips. |
marginBottom | int | Bottom margin for this section in twips. |
marginLeft | int | Left margin for this section in twips. |
marginHeader | int | Header margin in twips. |
marginFooter | int | Footer margin in twips. |
numberCols | int | Number of columns for this section. |
orient | string | Section page orientation (portrait or landscape). |
gutter | int | Gutter in twips (used for binding). |
bidi | bool | Set to true for right to left languages. Default as false. |
rtl | bool | Set to true for right to left languages. Default as false. |
excludeHeadersAndFooters | bool | If true, exclude headers and footers reference tags. Default as false. |
pageNumberType | array | Keys and values:
|
columns | array | Keys and values:
|
endnotes | array | Keys and values:
|
footnotes | array | Keys and values:
|
Release notes
- phpdocx 15.0:
- excludeHeadersAndFooters option.
- phpdocx 12.0:
- position, start, restart and format endnotes and footnotes options.
- supported generating multiple sections with more than one column applying custom widths and spaces.
- phpdocx 11.0:
- space option.
- phpdocx 9.0:
- pageNumberType option.