Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
AKritskiy authored and AKritskiy committed Jul 19, 2023
1 parent 351e24b commit 55ac236
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@ let data = [
{
sheet: "Adults",
columns: [
{ label: "User", value: "user" }, // Top level data
{ label: "Age", value: (row) => row.age + " years" }, // Custom format
{ label: "Phone", value: (row) => (row.more ? row.more.phone || "" : "") }, // Run functions
{ label: "User", value: "user", isFormula: true }, // Use formuls
{ label: "Age", value: "age", format: '# "years"' }, // Custom format
{ label: "Phone", value: (row: any) => row?.more?.phone ?? "", width: "5" }, // Run functions and add width
{ label: "Date", value: "date", format: "DD.MM.YYYY", type: "d" }, // Set type
],
content: [
{ user: "Andrea", age: 20, more: { phone: "11111111" } },
{ user: "Luis", age: 21, more: { phone: "12345678" } },
{ user: `=HYPERLINK("${window.location.origin}", "Alex")`, age: 20, more: { phone: "11111111" }, date: "1999.02.20" },
{ user: "Luis", age: 21, more: { phone: "12345678" }, date: "1999.01.21" },
],
},
{
sheet: "Children",
columns: [
{ label: "User", value: "user" }, // Top level data
{ label: "Age", value: "age", format: '# "years"' }, // Column format
{ label: "Phone", value: "more.phone", format: "(###) ###-####" }, // Deep props and column format
{ label: "Age", value: "age", format: '# "years"' }, // Custom format
{ label: "Phone", value: (row: any) => row?.more?.phone ?? "" }, // Run functions
],
content: [
{ user: "Manuel", age: 16, more: { phone: 9999999900 } },
{ user: "Ana", age: 17, more: { phone: 8765432135 } },
{ user: "Manuel", age: 16, more: { phone: "99999999" } },
{ user: "Ana", age: 17, more: { phone: "87654321" } },
],
},
]
Expand Down
2 changes: 1 addition & 1 deletion packages/main-library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "export-json-as-xlsx",
"version": "0.0.6",
"version": "0.0.7",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 55ac236

Please sign in to comment.