Skip to content

Named cell reference causes the string "undefined" to be output in the ODS file #1717

@dandv

Description

@dandv
const XLSX = require('xlsx');

const wb = XLSX.utils.book_new();

const ws = XLSX.utils.json_to_sheet([]);

XLSX.utils.book_append_sheet(wb, ws, 'Bug sheet');

ws.A1 = { t: 's', f: 'square' };

XLSX.writeFile(wb, 'formula.ods');

The resulting .ODS file contains:

<table:table-cell table:formula="of:=square" office:value-type="string"><text:p>undefined</text:p></table:table-cell>

Not sure what <text:p> is (probably a placeholder?), but it should simply be omitted in this case.

Adding a v: '' to the cell object outputs an empty <text:p></text:p>.

<table:table-cell table:formula="of:=square" office:value-type="string"><text:p></text:p></table:table-cell>

That, again, should be omitted, or optimized to <text:p/>.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions