Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to JSON.stringify() if unknown Cell.Type #137

Merged
merged 1 commit into from
Sep 14, 2016

Conversation

wulfsolter
Copy link
Contributor

No description provided.

@guyonroche
Copy link
Collaborator

Not sure I agree with this - what good would it do to add this cell-type?
How would it be rendered in the file output?

@wulfsolter
Copy link
Contributor Author

wulfsolter commented Sep 7, 2016

My use case for adding cell type is I'm attempting to generate XLS' of varied external data. Often enough a column of objects or other data pops up that isn't one of the ExcelJS types, and this gives a fall back output of JSON.stringified() which I think is better than breaking.

Re: How would it be rendered in the file output?

Any nested objects will be stringified.

{
    foo: {
        name: "Rolly",
        id: 12
    },
    baz: {
        property: 'value',
        deep: {
            evendeeper: {
                mariana: "trench"
            }
        }
    }
}

becomes

"{"foo":{"name":"Rolly","id":12},"baz":{"property":"value","deep":{"evendeeper":{"mariana":"trench"}}}}"

We can all agree that the output isn't exactly legible for my grandmother, but I think behaviour should be to output a spreadsheet of the data that is passed in, rather than failing or worse dropping.

The primary scenario is a client saying "hey all that data in the DB, can we have a copy?", and being able to export complete datasets - flattening and normalisation techniques are, by design, manipulating data.

@guyonroche guyonroche merged commit dd1d98d into exceljs:master Sep 14, 2016
@wulfsolter wulfsolter deleted the patch-2 branch September 14, 2016 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants