Sections
A DocumentSection is a logical division with its own page setup, columns, headers, footers, grid, and RTL flag. Use doc.AddSection().
Two Sections with Different Orientation
Use case: Mix portrait and landscape pages in one document.
C#
1using Vega;
2using Vega.DOM;
3using DOM.Enums;
4
5var doc = new VDocs();
6
7var portrait = doc.AddSection();
8portrait.PageSettings = new PageSetup
9{
10 PageSize = new PageSize(PaperSize.Letter),
11 Orientation = PageOrientation.Portrait,
12 Margin = new Margin(1.0, 1.0, 1.0, 1.0, Units.inch)
13};
14portrait.AddParagraph().AddText("Portrait section");
15
16var landscape = doc.AddSection();
17landscape.PageSettings = new PageSetup
18{
19 PageSize = new PageSize(PaperSize.Letter),
20 Orientation = PageOrientation.Landscape,
21 Margin = new Margin(0.75, 0.75, 0.75, 0.75, Units.inch)
22};
23landscape.AddParagraph().AddText("Landscape section");
Right-to-Left Section
Use case: Produce an RTL layout for languages like Arabic or Hebrew.
C#
1var rtl = doc.AddSection();
2rtl.RightToLeftLayout = true;
3rtl.TextFlowDirection = TextDirectionValues.rl;
4rtl.AddParagraph().AddText("مرحبا بالعالم");
Related API
Frequently asked questions
When should I add a section?
Whenever the layout must change: orientation, columns, headers/footers, or RTL direction.
Do section page settings override the document?
Yes. Each section's PageSettings wins over the document defaults.