Class DocxHeader
- Namespace
- DocToolkit
- Assembly
- DocToolkit.Primitives.dll
The content of one header or footer.
public sealed class DocxHeader
- Inheritance
-
DocxHeader
- Inherited Members
Remarks
Footers use this type too. Word's content model for the two is identical, and a second type differing only in its name would be one more thing to learn for no gain.
Attach it with WithHeader(DocxHeader) or WithFooter(DocxHeader); every producer that takes a PageSetup then honours it, with no extra overload.
Properties
Alignment
Where the line sits across the page.
public HeaderAlignment Alignment { get; }
Property Value
Segments
The pieces of the line, in order.
public IReadOnlyList<DocxHeaderSegment> Segments { get; }
Property Value
Methods
Of(HeaderAlignment, params DocxHeaderSegment[])
A header assembled from segments, in order.
public static DocxHeader Of(HeaderAlignment alignment, params DocxHeaderSegment[] segments)
Parameters
alignmentHeaderAlignmentWhere the line sits.
segmentsDocxHeaderSegment[]The pieces, in order. At least one is required.
Returns
Exceptions
- ArgumentNullException
segments, or an entry in it, is null.- ArgumentOutOfRangeException
alignmentis not a defined value.- ArgumentException
segmentsis empty.
Text(string, HeaderAlignment)
A header of a single run of text.
public static DocxHeader Text(string text, HeaderAlignment alignment = HeaderAlignment.Left)
Parameters
textstringThe text.
alignmentHeaderAlignmentWhere it sits. Defaults to Left.
Returns
Exceptions
- ArgumentNullException
textis null.- ArgumentOutOfRangeException
alignmentis not a defined value.
ToString()
The segments joined, with fields shown as {PAGE} and {NUMPAGES}.
public override string ToString()