# IWorkPagesDocument

Creates template-free native Pages documents with page settings, headers/footers, rich body paragraphs, images and scalar tables.

Class 

`OfficeIMO.IWork`

**Namespace**

`OfficeIMO.IWork`

**Assembly**

`OfficeIMO.IWork`

**Source revision**

`273d35d5ba8a` with working tree changes

**Source**

[IWorkPagesDocument.cs:55](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L55)

**Implements**

`IDisposable`

**Modifiers**

sealed

Creates template-free native Pages documents with page settings, headers/footers, rich body paragraphs, images and scalar tables.

## Inheritance

- object
- IWorkPagesDocument

## Remarks

Instances are not thread safe. This model does not modify loaded packages or measure pagination.

## Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 1

- Method [IWorkPagesDocument.Create](/api/iwork/officeimo-iwork-iworkpagesdocument/#method-create-single-single-single-single-single-single)

Filter members 

Show inherited

## Methods

`public IWorkPagesImage AddImage(byte[] data, float widthPoints, float heightPoints, string? accessibilityDescription = null, CancellationToken cancellationToken = default)` [#](#method-addimage-byte-single-single-string-threading-cancellationtoken)

[IWorkPagesDocument.cs:131](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L131)

Adds a validated PNG or JPEG snapshot as its own inline body paragraph.

Parameters

**data byte[] required**

**widthPoints float required**

**heightPoints float required**

**accessibilityDescription string? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`IWorkPagesImage`

AddParagraph 2 overloads

`public IWorkPagesParagraphData AddParagraph(string text, string fontName = "Arial", float fontSizePoints = 12, string color = "000000")` [#](#method-addparagraph-string-string-single-string)

[IWorkPagesDocument.cs:60](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L60)

Adds a left-aligned body paragraph with one font and opaque sRGB color.

Parameters

**text string required**

**fontName string = "Arial" optional**

**fontSizePoints float = 12 optional**

**color string = "000000" optional**

Returns

`IWorkPagesParagraphData`

`public IWorkPagesParagraphData AddParagraph(string text, IWorkPagesParagraphLayout layout, string fontName = "Arial", float fontSizePoints = 12, string color = "000000")` [#](#method-addparagraph-string-officeimo-iwork-iworkpagesparagraphlayout-string-single-string)

[IWorkPagesDocument.cs:66](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L66)

Adds a body paragraph with immutable layout and one font. TAB characters use its native tab stops.

Parameters

**text string required**

**layout OfficeIMO.IWork.IWorkPagesParagraphLayout required**

**fontName string = "Arial" optional**

**fontSizePoints float = 12 optional**

**color string = "000000" optional**

Returns

`IWorkPagesParagraphData`

AddRichParagraph 2 overloads

`public IWorkPagesParagraphData AddRichParagraph(IEnumerable<IWorkTextRunData> runs)` [#](#method-addrichparagraph-collections-generic-ienumerable-officeimo-iwork-iworktextrundata)

[IWorkPagesDocument.cs:74](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L74)

Adds a snapshot of rich character runs as one left-aligned body paragraph.

Parameters

**runs System.Collections.Generic.IEnumerable<OfficeIMO.IWork.IWorkTextRunData> required**

Returns

`IWorkPagesParagraphData`

`public IWorkPagesParagraphData AddRichParagraph(IEnumerable<IWorkTextRunData> runs, IWorkPagesParagraphLayout layout)` [#](#method-addrichparagraph-collections-generic-ienumerable-officeimo-iwork-iworktextrundata-officeimo-iwork-iworkpagesparagraphlayout)

[IWorkPagesDocument.cs:82](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L82)

Adds a snapshot of rich runs with immutable paragraph spacing and custom tabs.

Parameters

**runs System.Collections.Generic.IEnumerable<OfficeIMO.IWork.IWorkTextRunData> required**

**layout OfficeIMO.IWork.IWorkPagesParagraphLayout required**

Returns

`IWorkPagesParagraphData`

`public IWorkPagesTable AddTable(IWorkTableData data, string name = "Table 1", float columnWidthPoints = 100, float rowHeightPoints = 24, string fontName = "Arial", float fontSizePoints = 12, string color = "000000")` [#](#method-addtable-officeimo-iwork-iworktabledata-string-single-single-string-single-string)

[IWorkPagesDocument.cs:112](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L112)

Adds a snapshot of scalar data as an inline body table with equally sized rows and columns.

Parameters

**data OfficeIMO.IWork.IWorkTableData required**

**name string = "Table 1" optional**

**columnWidthPoints float = 100 optional**

**rowHeightPoints float = 24 optional**

**fontName string = "Arial" optional**

**fontSizePoints float = 12 optional**

**color string = "000000" optional**

Returns

`IWorkPagesTable`

`public void ClearFooter()` [#](#method-clearfooter)

[IWorkPagesDocument.PageText.cs:44](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L44)

Disables the footer and clears its text and distance.

`public void ClearHeader()` [#](#method-clearheader)

[IWorkPagesDocument.PageText.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L42)

Disables the header and clears its text and distance.

Create 2 overloads

`public static IWorkPagesDocument Create(float widthPoints = 612, float heightPoints = 792, float leftMarginPoints = 72, float rightMarginPoints = 72, float topMarginPoints = 72, float bottomMarginPoints = 72)` [#](#method-create-single-single-single-single-single-single)

[IWorkPagesDocument.cs:55](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L55)

Creates an empty document, using US Letter and one-inch margins by default.

Parameters

**widthPoints float = 612 optional**

**heightPoints float = 792 optional**

**leftMarginPoints float = 72 optional**

**rightMarginPoints float = 72 optional**

**topMarginPoints float = 72 optional**

**bottomMarginPoints float = 72 optional**

Returns

`IWorkPagesDocument`

`public static IWorkPagesDocument Create(string path)` [#](#method-create-string)

[IWorkPagesDocument.Lifecycle.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.Lifecycle.cs#L9)

Creates a native authoring model associated with a path, without writing a file.

Parameters

**path string required**

Returns

`IWorkPagesDocument`

CreateNumberedList 2 overloads

`public IWorkPagesNumberedList CreateNumberedList(string fontName = "Arial", float fontSizePoints = 12)` [#](#method-createnumberedlist-string-single)

[IWorkPagesDocument.cs:92](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L92)

Creates a decimal list; call AddItem or AddRichItem to insert body paragraphs.

Parameters

**fontName string = "Arial" optional**

**fontSizePoints float = 12 optional**

Returns

`IWorkPagesNumberedList`

`public IWorkPagesNumberedList CreateNumberedList(IWorkDecimalListMarkerStyle markerStyle, string fontName = "Arial", float fontSizePoints = 12)` [#](#method-createnumberedlist-officeimo-iwork-iworkdecimallistmarkerstyle-string-single)

[IWorkPagesDocument.cs:98](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L98)

Creates a decimal list with the selected marker punctuation at every level.

Parameters

**markerStyle OfficeIMO.IWork.IWorkDecimalListMarkerStyle required**

**fontName string = "Arial" optional**

**fontSizePoints float = 12 optional**

Returns

`IWorkPagesNumberedList`

`public void Dispose()` [#](#method-dispose)

[IWorkPagesDocument.Lifecycle.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.Lifecycle.cs#L18)

Completes this managed authoring model's lifetime. No native application, file or caller stream is retained.

Save 3 overloads

`public void Save(Stream destination, IWorkPagesSaveOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-save-io-stream-officeimo-iwork-iworkpagessaveoptions-threading-cancellationtoken)

[IWorkPagesDocument.cs:149](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L149)

Writes a completed package at the stream's current position and leaves the stream open.

Parameters

**destination System.IO.Stream required**

**options OfficeIMO.IWork.IWorkPagesSaveOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

`public void Save(string path, bool overwrite = false, IWorkPagesSaveOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-save-string-boolean-officeimo-iwork-iworkpagessaveoptions-threading-cancellationtoken)

[IWorkPagesDocument.cs:158](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L158)

Atomically saves a native package, rejecting an existing file unless overwrite is enabled.

Parameters

**path string required**

**overwrite bool = false optional**

**options OfficeIMO.IWork.IWorkPagesSaveOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

`public void Save(bool overwrite = false, IWorkPagesSaveOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-save-boolean-officeimo-iwork-iworkpagessaveoptions-threading-cancellationtoken)

[IWorkPagesDocument.Lifecycle.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.Lifecycle.cs#L15)

Saves to the associated path; replacing an existing file still requires explicit overwrite.

Parameters

**overwrite bool = false optional**

**options OfficeIMO.IWork.IWorkPagesSaveOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

SetFooter 2 overloads

`public void SetFooter(string text, string fontName = "Arial", float fontSizePoints = 12, string color = "000000", float distancePoints = 36)` [#](#method-setfooter-string-string-single-string-single)

[IWorkPagesDocument.PageText.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L32)

Sets one left-aligned footer paragraph for every page in the document's single section.

Parameters

**text string required**

**fontName string = "Arial" optional**

**fontSizePoints float = 12 optional**

**color string = "000000" optional**

**distancePoints float = 36 optional**

`public void SetFooter(IWorkTextRunData run, float distancePoints = 36)` [#](#method-setfooter-officeimo-iwork-iworktextrundata-single)

[IWorkPagesDocument.PageText.cs:37](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L37)

Sets a snapshot of one immutable character run as the left footer for every page.

Parameters

**run OfficeIMO.IWork.IWorkTextRunData required**

**distancePoints float = 36 optional**

SetHeader 2 overloads

`public void SetHeader(string text, string fontName = "Arial", float fontSizePoints = 12, string color = "000000", float distancePoints = 36)` [#](#method-setheader-string-string-single-string-single)

[IWorkPagesDocument.PageText.cs:18](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L18)

Sets one left-aligned header paragraph for every page in the document's single section.

Parameters

**text string required**

**fontName string = "Arial" optional**

**fontSizePoints float = 12 optional**

**color string = "000000" optional**

**distancePoints float = 36 optional**

`public void SetHeader(IWorkTextRunData run, float distancePoints = 36)` [#](#method-setheader-officeimo-iwork-iworktextrundata-single)

[IWorkPagesDocument.PageText.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L23)

Sets a snapshot of one immutable character run as the left header for every page.

Parameters

**run OfficeIMO.IWork.IWorkTextRunData required**

**distancePoints float = 36 optional**

`public byte[] ToBytes(IWorkPagesSaveOptions? options = null, CancellationToken cancellationToken = default)` [#](#method-tobytes-officeimo-iwork-iworkpagessaveoptions-threading-cancellationtoken)

[IWorkPagesDocument.cs:144](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L144)

Encodes a deterministic native Pages package without a template or native application.

Parameters

**options OfficeIMO.IWork.IWorkPagesSaveOptions? = null optional**

**cancellationToken System.Threading.CancellationToken = default optional**

Returns

`byte[]`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public IWorkCanvasSize PageSize { get; }` [#](#property-pagesize)

[IWorkPagesDocument.cs:32](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L32)

Gets page dimensions in points.

`public float LeftMarginPoints { get; }` [#](#property-leftmarginpoints)

[IWorkPagesDocument.cs:34](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L34)

Gets the left body margin in points.

`public float RightMarginPoints { get; }` [#](#property-rightmarginpoints)

[IWorkPagesDocument.cs:36](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L36)

Gets the right body margin in points.

`public float TopMarginPoints { get; }` [#](#property-topmarginpoints)

[IWorkPagesDocument.cs:38](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L38)

Gets the top body margin in points.

`public float BottomMarginPoints { get; }` [#](#property-bottommarginpoints)

[IWorkPagesDocument.cs:40](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L40)

Gets the bottom body margin in points.

`public IReadOnlyList<IWorkPagesParagraphData> Paragraphs { get; }` [#](#property-paragraphs)

[IWorkPagesDocument.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L42)

Gets the body paragraphs in insertion order.

`public IReadOnlyList<IWorkPagesTable> Tables { get; }` [#](#property-tables)

[IWorkPagesDocument.cs:44](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L44)

Gets authored inline tables in insertion order.

`public IReadOnlyList<IWorkPagesImage> Images { get; }` [#](#property-images)

[IWorkPagesDocument.cs:46](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L46)

Gets authored inline images in insertion order.

`public IReadOnlyList<IWorkPagesNumberedList> NumberedLists { get; }` [#](#property-numberedlists)

[IWorkPagesDocument.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L48)

Gets the document's decimal lists. Empty lists do not create body content or native styles.

`public IReadOnlyList<IWorkPagesBodyBlock> BodyBlocks { get; }` [#](#property-bodyblocks)

[IWorkPagesDocument.cs:50](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.cs#L50)

Gets paragraphs, images and tables in their shared body order.

`public string? FilePath { get; private set; }` [#](#property-filepath)

[IWorkPagesDocument.Lifecycle.cs:5](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.Lifecycle.cs#L5)

Gets the associated output path; stream saves do not change it.

`public IWorkTextRunData? Header { get; private set; }` [#](#property-header)

[IWorkPagesDocument.PageText.cs:5](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L5)

Gets the immutable left header run, or null when headers are disabled.

`public IWorkTextRunData? Footer { get; private set; }` [#](#property-footer)

[IWorkPagesDocument.PageText.cs:7](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L7)

Gets the immutable left footer run, or null when footers are disabled.

`public float HeaderDistancePoints { get; private set; }` [#](#property-headerdistancepoints)

[IWorkPagesDocument.PageText.cs:9](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L9)

Gets the native header distance from the page's top edge, in points.

`public float FooterDistancePoints { get; private set; }` [#](#property-footerdistancepoints)

[IWorkPagesDocument.PageText.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/273d35d5ba8ab8ce3f6f1238631241c0cea26d14/OfficeIMO.IWork/Creation/IWorkPagesDocument.PageText.cs#L11)

Gets the native footer distance from the page's bottom edge, in points.

<!-- PowerForge markdown artifact sha256:3B25027585269DEBC53F277A21959BF6AC16DF283B0A71C38660F600EE9F4758 -->
