Sections And Page Setup¶
Section APIs live on featherdoc::Document because they edit document-level
structure, page setup, and relationships to header and footer parts. Header and
footer content can then be edited through featherdoc::TemplatePart or the
paragraph handles returned by the section helpers.
Typed Signature Guide¶
Section indexes are zero-based. reference_kind selects the default,
first-page, or even-page header/footer reference. Methods returning
TemplatePart or Paragraph & may point at an unavailable part unless you
use an ensure_* helper first.
Signature |
Parameters |
Return semantics |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
Empty when the section or setup cannot be resolved. |
|
|
|
|
|
Template part handle for the resolved header. |
|
|
Paragraph entry for the ensured footer part. |
|
|
|
|
|
|
Section Info Types¶
Type |
Key fields |
Purpose |
|---|---|---|
|
|
Stores page size, orientation, margins, and optional page number start. |
|
|
Stores section margins in twips. |
|
|
Summarizes section and related-part state across the document. |
|
|
Describes one section and its resolved header/footer links. |
Section Structure¶
Method |
Returns |
Purpose |
|---|---|---|
|
|
Append a section break, optionally inheriting header/footer references. |
|
|
Insert a section before a target section index. |
|
|
Remove one section. |
|
|
Move a section to a new index. |
|
|
Count sections in the document. |
|
|
Inspect section count and header/footer linkage. |
|
|
Inspect one section. |
Page Setup¶
Method |
Returns |
Purpose |
|---|---|---|
|
|
Read page size, margins, orientation, and page numbering metadata. |
|
|
Write page setup metadata for one section. |
Example¶
featherdoc::Document doc{"template.docx"};
doc.open();
doc.append_section();
auto setup = doc.get_section_page_setup(0);
if (setup) {
setup->orientation = featherdoc::page_orientation::landscape;
doc.set_section_page_setup(0, *setup);
}
auto header = doc.section_header_template(
0, featherdoc::section_reference_kind::default_reference);
header.append_paragraph("Quarterly report");