Skip to content

Novis\Spreadsheet\Workbook

An Excel file (xlsx), an OpenDocument file (ods) or a CSV file that your program writes row by row. A name that ends in .ods or .csv, or format: 'ods' or format: 'csv', sets the format. Each create method sets where the file goes. Add a sheet with addSheet, add its rows, and call finish at the end.

Members

8 members.

MemberSignature
createForDownloadcreateForDownload(string $name, Options $options = null): Workbook
createForFilecreateForFile(string $path, Options $options = null): Workbook
createForStreamcreateForStream(Core\IO\File $file, Options $options = null): Workbook
createInMemorycreateInMemory(Options $options = null): Workbook
fromRowsfromRows(array<array<mixed>>|Iterable<array<mixed>>|Iterator<array<mixed>> $rows, ExportOptions $options = null): Export
addSheetaddSheet(string $name, SheetOptions $options = null): Sheet
defineNamedefineName(string $name, string $reference): Workbook
finishfinish(): Written

Types

Options

type Options = ?{    zone?: string,    format?: string,    properties?: {        title?: string,        subject?: string,        author?: string,        company?: string,        keywords?: string,        created?: Core\Time\Instant,    },    csv?: { separator?: string, quote?: string, charset?: Core\Charset },};

Column

type Column = {    header?: string,    width?: int | float | string,    format?: string,    style?: Style,    hidden?: bool,    formula?: callable(int): Formula,};

SheetOptions

type SheetOptions = ?{    columns?: array<Column>,    header?: bool,    freeze?: bool,    autofilter?: bool,    headerStyle?: Style | bool,    overflow?: string,    position?: uint,    hidden?: bool | string,    tabColor?: string,    zoom?: uint,    gridlines?: bool,    rightToLeft?: bool,};

ExportOptions

type ExportOptions = ?{    sheet?: string,    zone?: string,    format?: string,    properties?: {        title?: string,        subject?: string,        author?: string,        company?: string,        keywords?: string,        created?: Core\Time\Instant,    },    csv?: { separator?: string, quote?: string, charset?: Core\Charset },    columns?: array<Column>,    header?: bool,    freeze?: bool,    autofilter?: bool,    headerStyle?: Style | bool,    overflow?: string,    position?: uint,    hidden?: bool | string,    tabColor?: string,    zoom?: uint,    gridlines?: bool,    rightToLeft?: bool,};

RowOptions

type RowOptions = ?{    height?: float,    hidden?: bool,    level?: uint,    style?: Style,};

Value

type Value = { text: string }| { number: float }| { integer: int }| { decimal: string }| { boolean: bool }| { date: Core\Time\Date }| { time: Core\Time\TimeOfDay }| { duration: Core\Time\Duration }| { day: Core\Time\Date, clock: Core\Time\TimeOfDay }| { formula: string, cachedText: ?string, cachedNumber: ?float }| { runs: array<{ text: string, style: ?uint }> };

Entry

type Entry = { value: ?Value, style: ?uint };

Row

type Row = {    cells: array<Entry>,    style: ?uint,    height: ?float,    hidden: bool,    level: uint,    header: bool,};