API Reference
IWorkPagesDocument
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
Methods
public IWorkPagesImage AddImage(Byte[] data, Single widthPoints, Single heightPoints, String? accessibilityDescription = null, CancellationToken cancellationToken = default) #IWorkPagesImageAdds a validated PNG or JPEG snapshot as its own inline body paragraph.
Parameters
- data System.Byte[]
- widthPoints System.Single
- heightPoints System.Single
- accessibilityDescription System.String? = null
- cancellationToken System.Threading.CancellationToken = default
public IWorkPagesParagraphData AddParagraph(String text, String fontName = "Arial", Single fontSizePoints = 12, String color = "000000") #IWorkPagesParagraphDataAdds a left-aligned body paragraph with one font and opaque sRGB color.
Parameters
- text System.String
- fontName System.String = "Arial"
- fontSizePoints System.Single = 12
- color System.String = "000000"
public IWorkPagesParagraphData AddParagraph(String text, IWorkPagesParagraphLayout layout, String fontName = "Arial", Single fontSizePoints = 12, String color = "000000") #IWorkPagesParagraphDataAdds a body paragraph with immutable layout and one font. TAB characters use its native tab stops.
Parameters
- text System.String
- layout OfficeIMO.IWork.IWorkPagesParagraphLayout
- fontName System.String = "Arial"
- fontSizePoints System.Single = 12
- color System.String = "000000"
public IWorkPagesParagraphData AddRichParagraph(IEnumerable<IWorkTextRunData> runs) #IWorkPagesParagraphDataAdds a snapshot of rich character runs as one left-aligned body paragraph.
Parameters
- runs System.Collections.Generic.IEnumerable<OfficeIMO.IWork.IWorkTextRunData>
public IWorkPagesParagraphData AddRichParagraph(IEnumerable<IWorkTextRunData> runs, IWorkPagesParagraphLayout layout) #IWorkPagesParagraphDataAdds a snapshot of rich runs with immutable paragraph spacing and custom tabs.
Parameters
- runs System.Collections.Generic.IEnumerable<OfficeIMO.IWork.IWorkTextRunData>
- layout OfficeIMO.IWork.IWorkPagesParagraphLayout
public IWorkPagesTable AddTable(IWorkTableData data, String name = "Table 1", Single columnWidthPoints = 100, Single rowHeightPoints = 24, String fontName = "Arial", Single fontSizePoints = 12, String color = "000000") #IWorkPagesTableAdds a snapshot of scalar data as an inline body table with equally sized rows and columns.
Parameters
- data OfficeIMO.IWork.IWorkTableData
- name System.String = "Table 1"
- columnWidthPoints System.Single = 100
- rowHeightPoints System.Single = 24
- fontName System.String = "Arial"
- fontSizePoints System.Single = 12
- color System.String = "000000"
public static IWorkPagesDocument Create(Single widthPoints = 612, Single heightPoints = 792, Single leftMarginPoints = 72, Single rightMarginPoints = 72, Single topMarginPoints = 72, Single bottomMarginPoints = 72) #IWorkPagesDocumentCreates an empty document, using US Letter and one-inch margins by default.
Parameters
- widthPoints System.Single = 612
- heightPoints System.Single = 792
- leftMarginPoints System.Single = 72
- rightMarginPoints System.Single = 72
- topMarginPoints System.Single = 72
- bottomMarginPoints System.Single = 72
public IWorkPagesNumberedList CreateNumberedList(String fontName = "Arial", Single fontSizePoints = 12) #IWorkPagesNumberedListCreates a decimal list; call AddItem or AddRichItem to insert body paragraphs.
Parameters
- fontName System.String = "Arial"
- fontSizePoints System.Single = 12
public IWorkPagesNumberedList CreateNumberedList(IWorkDecimalListMarkerStyle markerStyle, String fontName = "Arial", Single fontSizePoints = 12) #IWorkPagesNumberedListCreates a decimal list with the selected marker punctuation at every level.
Parameters
- markerStyle OfficeIMO.IWork.IWorkDecimalListMarkerStyle
- fontName System.String = "Arial"
- fontSizePoints System.Single = 12
public Void Save(Stream destination, IWorkPagesWriteOptions? options = null, CancellationToken cancellationToken = default) #VoidWrites a completed package at the stream's current position and leaves the stream open.
Parameters
- destination System.IO.Stream
- options OfficeIMO.IWork.IWorkPagesWriteOptions? = null
- cancellationToken System.Threading.CancellationToken = default
public Void Save(String path, Boolean overwrite = false, IWorkPagesWriteOptions? options = null, CancellationToken cancellationToken = default) #VoidAtomically saves a native package, rejecting an existing file unless overwrite is enabled.
Parameters
- path System.String
- overwrite System.Boolean = false
- options OfficeIMO.IWork.IWorkPagesWriteOptions? = null
- cancellationToken System.Threading.CancellationToken = default
public Byte[] SaveBytes(IWorkPagesWriteOptions? options = null, CancellationToken cancellationToken = default) #Byte[]Encodes a deterministic native Pages package without a template or native application.
Parameters
- options OfficeIMO.IWork.IWorkPagesWriteOptions? = null
- cancellationToken System.Threading.CancellationToken = default
public Void SetHeader(String text, String fontName = "Arial", Single fontSizePoints = 12, String color = "000000", Single distancePoints = 36) #VoidSets one left-aligned header paragraph for every page in the document's single section.
Parameters
- text System.String
- fontName System.String = "Arial"
- fontSizePoints System.Single = 12
- color System.String = "000000"
- distancePoints System.Single = 36
public Void SetHeader(IWorkTextRunData run, Single distancePoints = 36) #VoidSets a snapshot of one immutable character run as the left header for every page.
Parameters
- run OfficeIMO.IWork.IWorkTextRunData
- distancePoints System.Single = 36
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public Single LeftMarginPoints { get; } #Gets the left body margin in points.
public Single RightMarginPoints { get; } #Gets the right body margin in points.
public Single BottomMarginPoints { get; } #Gets the bottom body margin in points.
public IReadOnlyList<IWorkPagesParagraphData> Paragraphs { get; } #Gets the body paragraphs in insertion order.
public IReadOnlyList<IWorkPagesTable> Tables { get; } #Gets authored inline tables in insertion order.
public IReadOnlyList<IWorkPagesImage> Images { get; } #Gets authored inline images in insertion order.
public IReadOnlyList<IWorkPagesNumberedList> NumberedLists { get; } #Gets the document's decimal lists. Empty lists do not create body content or native styles.
public IReadOnlyList<IWorkPagesBodyBlock> BodyBlocks { get; } #Gets paragraphs, images and tables in their shared body order.
public IWorkTextRunData? Header { get; private set; } #Gets the immutable left header run, or null when headers are disabled.
public Single HeaderDistancePoints { get; private set; } #Gets the native header distance from the page's top edge, in points.