TX Sheet Control

TabularSaveOptions Interface

Interface

Exports one worksheet's values, including calculated formula results, without changing the document.

Package: @txtextcontrol/tx-sheet-control-server. Version: 2.0.0.

Type-only declaration; it is not a JavaScript runtime constructor.

Members

Properties

PropertyDescription
hasHeaderRowFor JSON records and XML, use the first selected row as field names. Default true; false generates Column1, etc.
maxCellsMaximum selected rectangular cell count, including blanks. Defaults to 1,000,000.
maxFileBytesMaximum encoded output bytes; defaults to 32 MiB.
rangeInclusive A1 rectangle. Defaults to A1 through the last populated cell; formatting alone does not extend it.
sheetNameWorksheet name; defaults to the active worksheet.

Examples

Use a fresh workbook. Create and format the sample data, apply this API and retain the returned document or result in your application. In the browser pass editor.workbook; in Node.js pass the server control.

import type { ServerSheetControl } from '@txtextcontrol/tx-sheet-control-server';
import { StreamType, type TabularSaveOptions } from '@txtextcontrol/tx-sheet-control-server';

async function createTabularSaveOptionsReport(control: ServerSheetControl) {
    const book = control.workbook;
    const sheet = book.sheets.at(0);
    sheet.range('A1:C2').setValues([
        ['Customer', 'Amount', 'Total'],
        ['Müller', 125.5, null],
    ]);

    sheet.cell('C2').setFormula('=B2*1.19');

    const options: TabularSaveOptions = {
        sheetName: 'Sheet1',
        range: 'A1:C2',
        hasHeaderRow: true,
        maxCells: 10000,
        maxFileBytes: 1048576,
    };

    return await book.save(StreamType.XML, options);
}

See Also