Skip to content

Commit 55ac236

Browse files
AKritskiyAKritskiy
authored andcommitted
update example
1 parent 351e24b commit 55ac236

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,26 @@ let data = [
1313
{
1414
sheet: "Adults",
1515
columns: [
16-
{ label: "User", value: "user" }, // Top level data
17-
{ label: "Age", value: (row) => row.age + " years" }, // Custom format
18-
{ label: "Phone", value: (row) => (row.more ? row.more.phone || "" : "") }, // Run functions
16+
{ label: "User", value: "user", isFormula: true }, // Use formuls
17+
{ label: "Age", value: "age", format: '# "years"' }, // Custom format
18+
{ label: "Phone", value: (row: any) => row?.more?.phone ?? "", width: "5" }, // Run functions and add width
19+
{ label: "Date", value: "date", format: "DD.MM.YYYY", type: "d" }, // Set type
1920
],
2021
content: [
21-
{ user: "Andrea", age: 20, more: { phone: "11111111" } },
22-
{ user: "Luis", age: 21, more: { phone: "12345678" } },
22+
{ user: `=HYPERLINK("${window.location.origin}", "Alex")`, age: 20, more: { phone: "11111111" }, date: "1999.02.20" },
23+
{ user: "Luis", age: 21, more: { phone: "12345678" }, date: "1999.01.21" },
2324
],
2425
},
2526
{
2627
sheet: "Children",
2728
columns: [
2829
{ label: "User", value: "user" }, // Top level data
29-
{ label: "Age", value: "age", format: '# "years"' }, // Column format
30-
{ label: "Phone", value: "more.phone", format: "(###) ###-####" }, // Deep props and column format
30+
{ label: "Age", value: "age", format: '# "years"' }, // Custom format
31+
{ label: "Phone", value: (row: any) => row?.more?.phone ?? "" }, // Run functions
3132
],
3233
content: [
33-
{ user: "Manuel", age: 16, more: { phone: 9999999900 } },
34-
{ user: "Ana", age: 17, more: { phone: 8765432135 } },
34+
{ user: "Manuel", age: 16, more: { phone: "99999999" } },
35+
{ user: "Ana", age: 17, more: { phone: "87654321" } },
3536
],
3637
},
3738
]

packages/main-library/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "export-json-as-xlsx",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)