Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit bb30417

Browse files
authored
Merge pull request #1064 from ghiscoding/feat/excel-column-export-styling
feat(exports): add auto-detect and Excel custom cell (column) styling
2 parents 2646527 + 8260031 commit bb30417

File tree

4 files changed

+102
-83
lines changed

4 files changed

+102
-83
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
},
5151
"dependencies": {
5252
"@ngx-translate/core": ">=14.0.0",
53-
"@slickgrid-universal/common": "~2.1.3",
54-
"@slickgrid-universal/custom-footer-component": "~2.1.3",
55-
"@slickgrid-universal/empty-warning-component": "~2.1.3",
53+
"@slickgrid-universal/common": "~2.2.0",
54+
"@slickgrid-universal/custom-footer-component": "~2.2.0",
55+
"@slickgrid-universal/empty-warning-component": "~2.2.0",
5656
"@slickgrid-universal/event-pub-sub": "~2.1.2",
57-
"@slickgrid-universal/pagination-component": "~2.1.3",
58-
"@slickgrid-universal/row-detail-view-plugin": "~2.1.3",
59-
"@slickgrid-universal/rxjs-observable": "~2.1.3",
57+
"@slickgrid-universal/pagination-component": "~2.2.0",
58+
"@slickgrid-universal/row-detail-view-plugin": "~2.2.0",
59+
"@slickgrid-universal/rxjs-observable": "~2.2.0",
6060
"@types/jquery": "^3.5.14",
6161
"dequal": "^2.0.3",
6262
"dompurify": "^2.4.1",
@@ -88,12 +88,12 @@
8888
"@ngx-translate/core": "^14.0.0",
8989
"@ngx-translate/http-loader": "^7.0.0",
9090
"@release-it/conventional-changelog": "^5.1.1",
91-
"@slickgrid-universal/composite-editor-component": "~2.1.3",
92-
"@slickgrid-universal/custom-tooltip-plugin": "~2.1.3",
93-
"@slickgrid-universal/excel-export": "~2.1.3",
94-
"@slickgrid-universal/graphql": "~2.1.3",
95-
"@slickgrid-universal/odata": "~2.1.3",
96-
"@slickgrid-universal/text-export": "~2.1.3",
91+
"@slickgrid-universal/composite-editor-component": "~2.2.0",
92+
"@slickgrid-universal/custom-tooltip-plugin": "~2.2.0",
93+
"@slickgrid-universal/excel-export": "~2.2.0",
94+
"@slickgrid-universal/graphql": "~2.2.0",
95+
"@slickgrid-universal/odata": "~2.2.0",
96+
"@slickgrid-universal/text-export": "~2.2.0",
9797
"@types/dompurify": "^2.4.0",
9898
"@types/flatpickr": "^3.1.2",
9999
"@types/fnando__sparkline": "^0.3.4",

src/app/examples/grid-clientside.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class GridClientSideComponent implements OnInit {
123123
filterable: true, filter: { model: Filters.compoundInputNumber }
124124
},
125125
{
126-
id: 'start', name: 'Start', field: 'start', formatter: Formatters.dateIso, sortable: true, minWidth: 75, exportWithFormatter: false,
126+
id: 'start', name: 'Start', field: 'start', formatter: Formatters.dateIso, sortable: true, minWidth: 75,
127127
type: FieldType.date, filterable: true, filter: { model: Filters.compoundDate }
128128
},
129129
{

src/app/examples/grid-grouping.component.ts

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,34 @@ export class GridGroupingComponent implements OnInit {
107107
},
108108
{
109109
id: 'cost', name: 'Cost', field: 'cost',
110-
minWidth: 70,
111-
width: 100,
112-
filterable: true,
110+
minWidth: 70, width: 80,
111+
sortable: true, filterable: true,
113112
filter: { model: Filters.compoundInputNumber },
114113
type: FieldType.number,
115-
sortable: true,
116-
exportWithFormatter: true,
117-
formatter: Formatters.dollar,
118-
groupTotalsFormatter: GroupTotalFormatters.sumTotalsDollar,
119-
params: { groupFormatterPrefix: '<b>Total</b>: ' /*, groupFormatterSuffix: ' USD'*/ }
114+
formatter: Formatters.currency,
115+
groupTotalsFormatter: GroupTotalFormatters.sumTotalsCurrency,
116+
params: { displayNegativeNumberWithParentheses: true, currencyPrefix: '€', groupFormatterCurrencyPrefix: '€', minDecimal: 2, maxDecimal: 4, groupFormatterPrefix: '<b>Total</b>: ' },
117+
excelExportOptions: {
118+
style: {
119+
font: { outline: true, italic: true },
120+
format: '€0.00##;[Red](€0.00##)',
121+
},
122+
width: 18
123+
},
124+
groupTotalsExcelExportOptions: {
125+
style: {
126+
alignment: { horizontal: 'center' },
127+
font: { bold: true, color: 'FF005289', underline: 'single', fontName: 'Consolas', size: 10 },
128+
fill: { type: 'pattern', patternType: 'solid', fgColor: 'FFE6F2F6' },
129+
border: {
130+
top: { color: 'FFa500ff', style: 'thick', },
131+
left: { color: 'FFa500ff', style: 'medium', },
132+
right: { color: 'FFa500ff', style: 'dotted', },
133+
bottom: { color: 'FFa500ff', style: 'double', },
134+
},
135+
format: '"Total: "€0.00##;[Red]"Total: "(€0.00##)'
136+
},
137+
},
120138
},
121139
{
122140
id: 'effort-driven', name: 'Effort Driven',
@@ -169,6 +187,7 @@ export class GridGroupingComponent implements OnInit {
169187
const randomMonth = Math.floor(Math.random() * 11);
170188
const randomDay = Math.floor((Math.random() * 29));
171189
const randomPercent = Math.round(Math.random() * 100);
190+
const randomCost = (i % 33 === 0) ? null : Math.round(Math.random() * 10000) / 100;
172191

173192
this.dataset[i] = {
174193
id: 'id_' + i,
@@ -179,7 +198,7 @@ export class GridGroupingComponent implements OnInit {
179198
percentCompleteNumber: randomPercent,
180199
start: new Date(randomYear, randomMonth, randomDay),
181200
finish: new Date(randomYear, (randomMonth + 1), randomDay),
182-
cost: (i % 33 === 0) ? null : Math.round(Math.random() * 10000) / 100,
201+
cost: i % 3 ? randomCost : randomCost !== null ? -randomCost : null,
183202
effortDriven: (i % 5 === 0)
184203
};
185204
}

yarn.lock

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,55 +2187,55 @@
21872187
dependencies:
21882188
dompurify "^2.4.1"
21892189

2190-
"@slickgrid-universal/common@~2.1.3":
2191-
version "2.1.3"
2192-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/common/-/common-2.1.3.tgz#2cda473fa8ec256cd71d1d2659d6438f48135d2b"
2193-
integrity sha512-TB3aorzwyByI0r3JMGwIm2KmNQzY3F9U7WEbd4IQhcYmqxvX6n4JQPsyCqqIUYkEB6zSslLixs+eL6CT/OgjzA==
2190+
"@slickgrid-universal/common@~2.2.0":
2191+
version "2.2.0"
2192+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/common/-/common-2.2.0.tgz#801abeddb8f15e5d26658441e018e00f44fb4cfa"
2193+
integrity sha512-6o/Gu7pPCbG9gG+CJ4ZQV3vi5L/pa6DJ20DvYdgazy8oBqZ6Tc7LnAaAQoFLf9qtoYiNYluEJop6Mdhug7jA1A==
21942194
dependencies:
21952195
"@slickgrid-universal/event-pub-sub" "~2.1.2"
21962196
"@slickgrid-universal/utils" "~2.1.2"
21972197
autocompleter "^7.0.1"
21982198
dequal "^2.0.3"
21992199
dompurify "^2.4.1"
22002200
flatpickr "^4.6.13"
2201-
jquery "^3.6.1"
2201+
jquery "^3.6.2"
22022202
moment-mini "^2.29.4"
22032203
multiple-select-modified "^1.3.17"
22042204
slickgrid "^3.0.2"
22052205
sortablejs "^1.15.0"
22062206
un-flatten-tree "^2.0.12"
22072207

2208-
"@slickgrid-universal/composite-editor-component@~2.1.3":
2209-
version "2.1.3"
2210-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/composite-editor-component/-/composite-editor-component-2.1.3.tgz#5842e31c6d6a9b1edc4798da08b7d12e45246f02"
2211-
integrity sha512-eBI15oBimvq3Vu7TioHXro2loMTKyIixTpT5tVas3br9GILO66gSCYph5itWIal1VCvZAIE7OHIyJt+VaL04aQ==
2208+
"@slickgrid-universal/composite-editor-component@~2.2.0":
2209+
version "2.2.0"
2210+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/composite-editor-component/-/composite-editor-component-2.2.0.tgz#c2cd06a0b27745807c964db3992a6919ea358506"
2211+
integrity sha512-BrFhR3JQ8w707zTy8/OJHq4bflR9ivX9+CIJ3qYaozQBYRimIeoDIiouLUeHggVEyudpXrf1Ygd2x97MBw9DeQ==
22122212
dependencies:
2213-
"@slickgrid-universal/common" "~2.1.3"
2213+
"@slickgrid-universal/common" "~2.2.0"
22142214
"@slickgrid-universal/utils" "~2.1.2"
22152215

2216-
"@slickgrid-universal/custom-footer-component@~2.1.3":
2217-
version "2.1.3"
2218-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/custom-footer-component/-/custom-footer-component-2.1.3.tgz#ef0d7b94dc2ab6ec6e145f4e9c46b5088584dba1"
2219-
integrity sha512-taLm/RXoEV6biml6EBu+TbYOJRJiMSF5d77i6nFoOmcvXN9ArYvDPhiE5URF4qkMrPs0esUX1NYLg0o81+Ao5Q==
2216+
"@slickgrid-universal/custom-footer-component@~2.2.0":
2217+
version "2.2.0"
2218+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/custom-footer-component/-/custom-footer-component-2.2.0.tgz#5d6838a83c8074bb999cc69b64c1523e827e261b"
2219+
integrity sha512-QlVIBYl1AoUshYA8wlwn8hIE6KRt1sCEMCkFJ73GP5G8OEpomaGN4Ni2dcqmU62fDJFoNBrkCB+u/g6/jxLJ/Q==
22202220
dependencies:
22212221
"@slickgrid-universal/binding" "~2.1.2"
2222-
"@slickgrid-universal/common" "~2.1.3"
2222+
"@slickgrid-universal/common" "~2.2.0"
22232223
moment-mini "^2.29.4"
22242224

2225-
"@slickgrid-universal/custom-tooltip-plugin@~2.1.3":
2226-
version "2.1.3"
2227-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/custom-tooltip-plugin/-/custom-tooltip-plugin-2.1.3.tgz#1b601d2b413ea36bc470ee1c6a989d2eca18b6d1"
2228-
integrity sha512-XLCYKd+Jcuo2LqS0FKCqMixgT1+1UKFaUurBr0AfLl63uhUT9s6mJwD4bez20ldXTq0EJZhk3Pe8kKjSuls/UA==
2225+
"@slickgrid-universal/custom-tooltip-plugin@~2.2.0":
2226+
version "2.2.0"
2227+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/custom-tooltip-plugin/-/custom-tooltip-plugin-2.2.0.tgz#a80759dec54471c4f567dd2f1dcd07f7f9bb0705"
2228+
integrity sha512-I+lgt0y2Jbhx+Qh1ManiyAizHjdSqrtzYve4QU7cBzVKa1oVeXghbLk+26XGVy/s7Dh7SjxI/AC2I3j/kLOWzA==
22292229
dependencies:
2230-
"@slickgrid-universal/common" "~2.1.3"
2230+
"@slickgrid-universal/common" "~2.2.0"
22312231
dompurify "^2.4.1"
22322232

2233-
"@slickgrid-universal/empty-warning-component@~2.1.3":
2234-
version "2.1.3"
2235-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/empty-warning-component/-/empty-warning-component-2.1.3.tgz#6fd4af16200051b5a20bc8b47eadc074504b3730"
2236-
integrity sha512-YS82+TQMeHR7nvlBXT61/rx2Nol0AE3zSafKsMIM5BwPq/uw7JjbiXEUws9jnPOnkM9k/hlukDEXjsIl53Rszw==
2233+
"@slickgrid-universal/empty-warning-component@~2.2.0":
2234+
version "2.2.0"
2235+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/empty-warning-component/-/empty-warning-component-2.2.0.tgz#fb14fe77ae7d5158c36bf953aa01d4eb821bd724"
2236+
integrity sha512-fnJu92ChswZ2KiR0PcojXvAhLb0O6Na4i2WLxOa0jFbsi2YL9lQBoHIR+WMMvvFgUdp2EQbaPooiH9ZKLyZH6g==
22372237
dependencies:
2238-
"@slickgrid-universal/common" "~2.1.3"
2238+
"@slickgrid-universal/common" "~2.2.0"
22392239

22402240
"@slickgrid-universal/event-pub-sub@~2.1.2":
22412241
version "2.1.2"
@@ -2244,60 +2244,60 @@
22442244
dependencies:
22452245
"@slickgrid-universal/utils" "~2.1.2"
22462246

2247-
"@slickgrid-universal/excel-export@~2.1.3":
2248-
version "2.1.3"
2249-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/excel-export/-/excel-export-2.1.3.tgz#769d6fb64694daad537b683107292beb0aa8af28"
2250-
integrity sha512-A9Azoa7QYrVhjEnKPbdtMjsKS1xWQPePL4Bvc4rgnUgxTBc2C/jzhynclCIj+0s5wPN8RtN7YK3VkMHOMJl/6Q==
2247+
"@slickgrid-universal/excel-export@~2.2.0":
2248+
version "2.2.0"
2249+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/excel-export/-/excel-export-2.2.0.tgz#59fdb9e2df16f10539107d5868e769f65251bf17"
2250+
integrity sha512-8+SADfcUZGx35KoqsYtC0KyGNkWgiFej8P6JIKrX3mlZ9hK0UqZ4G2Y72LM/KWdpDe5oV+PfPA5v6cgEiO9AKQ==
22512251
dependencies:
2252-
"@slickgrid-universal/common" "~2.1.3"
2252+
"@slickgrid-universal/common" "~2.2.0"
22532253
"@slickgrid-universal/utils" "~2.1.2"
22542254
excel-builder-webpacker "^2.1.7"
22552255
moment-mini "^2.29.4"
22562256

2257-
"@slickgrid-universal/graphql@~2.1.3":
2258-
version "2.1.3"
2259-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/graphql/-/graphql-2.1.3.tgz#2171f33145955f5ef6d09cd62b5877c11737d229"
2260-
integrity sha512-CZofUGs3+YhJlr8ePava2oZlhy2YzPTFNiS1Qb6WTe8PVSn4lxVafkcsqsXBn+GryzRKdZGH7omCP26NLOHVVQ==
2257+
"@slickgrid-universal/graphql@~2.2.0":
2258+
version "2.2.0"
2259+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/graphql/-/graphql-2.2.0.tgz#2ae7383b52d0c2db759475d921c5fec55bbd055f"
2260+
integrity sha512-N6EqCad2WPeY7qtvY/5M+AbKT/37hQevjXycpbQmkdDtp9ecf1Oc3cu100P+I2U0QKRWmYWQppmxQfjt9Leiag==
22612261
dependencies:
2262-
"@slickgrid-universal/common" "~2.1.3"
2262+
"@slickgrid-universal/common" "~2.2.0"
22632263

2264-
"@slickgrid-universal/odata@~2.1.3":
2265-
version "2.1.3"
2266-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/odata/-/odata-2.1.3.tgz#0435a4f45cedb88f4e7b0822d3ae52c38029ab4e"
2267-
integrity sha512-fQ5iqrU72OTD/6YO7VwGjWHuzYfmBrtKLA0JgOXQa26oNT3z1iiu588WdquXy5GxC1gzkLYnwPh/s3DGXxkj2w==
2264+
"@slickgrid-universal/odata@~2.2.0":
2265+
version "2.2.0"
2266+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/odata/-/odata-2.2.0.tgz#14c139c4d05907f274712722cc0e4e0388cd0969"
2267+
integrity sha512-jM/b/IlX1vJxtyCzovE23NNKcDpr1k8zQwI+Ak5r/u8e63AWCpDXNv1yLHDGfRRiJEygxpecEtbkpamXqQ6bdQ==
22682268
dependencies:
2269-
"@slickgrid-universal/common" "~2.1.3"
2269+
"@slickgrid-universal/common" "~2.2.0"
22702270
"@slickgrid-universal/utils" "~2.1.2"
22712271

2272-
"@slickgrid-universal/pagination-component@~2.1.3":
2273-
version "2.1.3"
2274-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/pagination-component/-/pagination-component-2.1.3.tgz#e9d9a451f92810b278d60be788eb506673436a35"
2275-
integrity sha512-JR1OW0upw7yK6h2BEjfbaKL6qiReb7AymTQnbdlZibo3MEXFvd6AAA8Bd8QdMAjJXoBrMgkz6cFbUdKW8lifZQ==
2272+
"@slickgrid-universal/pagination-component@~2.2.0":
2273+
version "2.2.0"
2274+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/pagination-component/-/pagination-component-2.2.0.tgz#4cec43fa63877b947e57dcbee928e2db01576802"
2275+
integrity sha512-7c+NTgqhBZdBFuf7bjmzwvVH4+DyWjqu5nSJF9Oum6Z+CiupZwW/qKicfIWqAkMw/Bhd4jmuHCQQJq57aZrACA==
22762276
dependencies:
22772277
"@slickgrid-universal/binding" "~2.1.2"
2278-
"@slickgrid-universal/common" "~2.1.3"
2278+
"@slickgrid-universal/common" "~2.2.0"
22792279

2280-
"@slickgrid-universal/row-detail-view-plugin@~2.1.3":
2281-
version "2.1.3"
2282-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/row-detail-view-plugin/-/row-detail-view-plugin-2.1.3.tgz#b2c535cf0df78b57fc967cd9cb1d8debc38624fb"
2283-
integrity sha512-2g6Y3RAmink2U5n9C08n0jBimHbRlkYnr26U+bPVlG5E6Hvf/0nXW2c90jKIa+LFbrDrDrmzFCghE+4wDzMZFA==
2280+
"@slickgrid-universal/row-detail-view-plugin@~2.2.0":
2281+
version "2.2.0"
2282+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/row-detail-view-plugin/-/row-detail-view-plugin-2.2.0.tgz#41210f5aaf81e2b320bd5ce5d9d6d13c52fefa88"
2283+
integrity sha512-fO6H/1jhuDAzJm+Q45XshwyTZxIZGQH4nMFpwr+FlcfJUbyTR4g3uAv8OZLW29EjGmK25UTj+RqNvw5y7R8Naw==
22842284
dependencies:
2285-
"@slickgrid-universal/common" "~2.1.3"
2285+
"@slickgrid-universal/common" "~2.2.0"
22862286

2287-
"@slickgrid-universal/rxjs-observable@~2.1.3":
2288-
version "2.1.3"
2289-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/rxjs-observable/-/rxjs-observable-2.1.3.tgz#fb673a9f1a90f3e07ed6985f5e15c403b12b7843"
2290-
integrity sha512-MexDlEnMjDQN6FOg91bnQ8QZxGNq1WQGawSFG22ZgfdowoyN7wOz5PFUhwQsTekv488HR/shfgfRCJWH1GninQ==
2287+
"@slickgrid-universal/rxjs-observable@~2.2.0":
2288+
version "2.2.0"
2289+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/rxjs-observable/-/rxjs-observable-2.2.0.tgz#33f40a615592b66ae4d11bd0618f598c7b29fb10"
2290+
integrity sha512-jJjvIOKZKwWe7croTAjXctxQK6GD7u/eBpV67YKqlq+kjtgYVtjMfOHkfMhZA4xBEW8tKFs/zeta2wAx7/BoaQ==
22912291
dependencies:
2292-
"@slickgrid-universal/common" "~2.1.3"
2292+
"@slickgrid-universal/common" "~2.2.0"
22932293
rxjs ">=7.5.0"
22942294

2295-
"@slickgrid-universal/text-export@~2.1.3":
2296-
version "2.1.3"
2297-
resolved "https://registry.yarnpkg.com/@slickgrid-universal/text-export/-/text-export-2.1.3.tgz#ce23be55c683c067093968555f717133535ea329"
2298-
integrity sha512-uGvx+BtE/0TmNA2ftkjArN82DFFAIst307H7Mh1PQVDcX7oyO5lfRXoj/qebmGASY+5IgnQSprOLozOHyq8mXg==
2295+
"@slickgrid-universal/text-export@~2.2.0":
2296+
version "2.2.0"
2297+
resolved "https://registry.yarnpkg.com/@slickgrid-universal/text-export/-/text-export-2.2.0.tgz#02581370b247dd3b841faa2eb8e1976eabf2c30c"
2298+
integrity sha512-C4NuEWdnzL5wu5a328UWvZWoAy0ApbMUslFPqzXf8UOO07LUE8zEf2B+JOqT8QExJSfEQyMCqobKYhlcMLK9dw==
22992299
dependencies:
2300-
"@slickgrid-universal/common" "~2.1.3"
2300+
"@slickgrid-universal/common" "~2.2.0"
23012301
"@slickgrid-universal/utils" "~2.1.2"
23022302
text-encoding-utf-8 "^1.0.2"
23032303

@@ -7495,7 +7495,7 @@ jest@^29.3.1:
74957495
import-local "^3.0.2"
74967496
jest-cli "^29.3.1"
74977497

7498-
jquery@>=3.0.0, jquery@^3.5.1, jquery@^3.6.1:
7498+
jquery@>=3.0.0, jquery@^3.5.1:
74997499
version "3.6.1"
75007500
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.1.tgz#fab0408f8b45fc19f956205773b62b292c147a16"
75017501
integrity sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==

0 commit comments

Comments
 (0)